Skip to content

Commit 543c473

Browse files
committed
Merge branch 'master' into release-1.10
2 parents fc6f0a2 + 174a57d commit 543c473

File tree

59 files changed

+2484
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2484
-563
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ext {
2222
targetSdkVersion = 33
2323

2424
androidXVersions = [
25-
activity : '1.8.0-alpha05',
25+
activity : '1.8.0-alpha06',
2626
annotation : '1.2.0',
2727
appCompat : '1.6.1',
2828
cardView : '1.0.0',
@@ -58,7 +58,7 @@ ext {
5858
? project.property('mavenRepoUrl') : '/tmp/myRepo/')
5959

6060
// Current version of the library (could be in-development/unreleased).
61-
mdcLibraryVersion = '1.10.0-alpha04'
61+
mdcLibraryVersion = '1.10.0-alpha05'
6262
mdcLibraryPackage = "com.google.android.material"
6363
mdcLibraryDir = "com/google/android/material"
6464
}

catalog/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
api 'androidx.constraintlayout:constraintlayout:2.1.0'
1717
api 'androidx.gridlayout:gridlayout:1.0.0'
1818
api "androidx.multidex:multidex:2.0.1"
19-
api "androidx.activity:activity:1.8.0-alpha05"
19+
api "androidx.activity:activity:1.8.0-alpha06"
2020
api "androidx.recyclerview:recyclerview:1.2.1"
2121
api 'androidx.window:window:1.0.0-beta04'
2222
api "androidx.window:window-java:1.0.0-beta04"

catalog/java/io/material/catalog/bottomnav/BottomNavigationDemoFragment.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public abstract class BottomNavigationDemoFragment extends DemoFragment {
5050
new int[] {
5151
BadgeDrawable.TOP_END,
5252
BadgeDrawable.TOP_START,
53-
BadgeDrawable.BOTTOM_END,
54-
BadgeDrawable.BOTTOM_START
5553
};
5654

5755
private int numVisibleChildren = 3;

catalog/java/io/material/catalog/bottomnav/res/values/arrays.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@
1919
<string-array name="cat_bottom_nav_badge_gravity_titles">
2020
<item>@string/cat_bottom_nav_badge_gravity_top_end</item>
2121
<item>@string/cat_bottom_nav_badge_gravity_top_start</item>
22-
<item>@string/cat_bottom_nav_badge_gravity_bottom_end</item>
23-
<item>@string/cat_bottom_nav_badge_gravity_bottom_start</item>
2422
</string-array>
2523
</resources>

catalog/java/io/material/catalog/bottomnav/res/values/strings.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353

5454
<string name="cat_bottom_nav_badge_gravity_top_end">Top end</string>
5555
<string name="cat_bottom_nav_badge_gravity_top_start">Top start</string>
56-
<string name="cat_bottom_nav_badge_gravity_bottom_end">Bottom end</string>
57-
<string name="cat_bottom_nav_badge_gravity_bottom_start">Bottom start</string>
5856

5957
<string name="cat_bottom_nav_badge_gravity_spinner_label">Badge gravity</string>
6058
<string name="cat_bottom_nav_label_active_bold" translatable="false">Bold active label</string>

catalog/java/io/material/catalog/navigationrail/NavigationRailDemoFragment.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public class NavigationRailDemoFragment extends DemoFragment {
5050
new int[] {
5151
BadgeDrawable.TOP_END,
5252
BadgeDrawable.TOP_START,
53-
BadgeDrawable.BOTTOM_END,
54-
BadgeDrawable.BOTTOM_START
5553
};
5654

5755
private int numVisibleChildren = 3;

catalog/java/io/material/catalog/navigationrail/res/values/arrays.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@
1919
<string-array name="cat_navigation_rail_badge_gravity_titles">
2020
<item>@string/cat_navigation_rail_badge_gravity_top_end</item>
2121
<item>@string/cat_navigation_rail_badge_gravity_top_start</item>
22-
<item>@string/cat_navigation_rail_badge_gravity_bottom_end</item>
23-
<item>@string/cat_navigation_rail_badge_gravity_bottom_start</item>
2422
</string-array>
2523
</resources>

catalog/java/io/material/catalog/navigationrail/res/values/strings.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@
8989
description="Label for the option that will cause badges to be positioned at the end, above the icon. [CHAR_LIMIT=50]">Top end</string>
9090
<string name="cat_navigation_rail_badge_gravity_top_start"
9191
description="Label for the option that will cause badges to be positioned at the start, above the icon. [CHAR_LIMIT=50]">Top start</string>
92-
<string name="cat_navigation_rail_badge_gravity_bottom_end"
93-
description="Label for the option that will cause badges to be positioned at the end, below the icon. [CHAR_LIMIT=50]">Bottom end</string>
94-
<string name="cat_navigation_rail_badge_gravity_bottom_start"
95-
description="Label for the option that will cause badges to be positioned at starting, below the icon. [CHAR_LIMIT=50]">Bottom start</string>
9692
<string name="cat_navigation_rail_label_active_bold"
9793
description="Label for controlling whether the active label is bold. [CHAR_LIMIT=50]" translatable="false">Bold active label</string>
9894

docs/components/BadgeDrawable.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ can specify a `FrameLayout` to display the badge instead.
7676

7777
### `BadgeDrawable` Gravity Modes
7878

79-
`BadgeDrawable` provides four pre-packaged gravity modes that control how the
80-
badge aligns with its anchor view. By default (`TOP_END`) badge aligns with the
81-
top and end edges of the anchor (with some offsets). The other options are
82-
`TOP_START`, `BOTTOM_START` and `BOTTOM_END`.
79+
`BadgeDrawable` offers two gravity modes to control how the badge aligns with
80+
its anchor view. By default, (`TOP_END`) badge aligns with the top and end edges
81+
of the anchor (with some offsets). Alternatively, you can use `TOP_START` to
82+
align the badge with the top and start edges of the anchor. Note that
83+
`BOTTOM_START` and `BOTTOM_END` are deprecated and not recommended for use.
8384

8485
### `BadgeDrawable` center offsets
8586

@@ -90,21 +91,22 @@ center, use `setHorizontalOffset(int)` or `setVerticalOffset(int)`
9091

9192
### `BadgeDrawable` Attributes
9293

93-
| Feature | Relevant attributes |
94-
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
95-
| Color | `app:backgroundColor` <br> `app:badgeTextColor` |
96-
| Width | `app:badgeWidth` <br> `app:badgeWithTextWidth` |
97-
| Height | `app:badgeHeight` <br> `app:badgeWithTextHeight` |
98-
| Shape | `app:badgeShapeAppearance` <br> `app:badgeShapeAppearanceOverlay` <br> `app:badgeWithTextShapeAppearance` <br> `app:badgeWithTextShapeAppearanceOverlay` |
99-
| Label | `app:badgeText` (for text) <br> `app:number` (for numbers) |
100-
| Label Length | `app:maxCharacterCount` (for all text) <br> `app:maxNumber` (for numbers only) |
101-
| Label Text Color | `app:badgeTextColor` |
102-
| Label Text Appearance | `app:badgeTextAppearance` |
103-
| Badge Gravity | `app:badgeGravity` |
104-
| Offset Alignment | `app:offsetAlignmentMode` |
105-
| Horizontal Padding | `app:badgeWidePadding` |
106-
| Vertical Padding | `app:badgeVerticalPadding` |
107-
| Auto Adjust | `app:autoAdjustToWithinGrandparentBounds` |
94+
| Feature | Relevant attributes |
95+
|----------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------|
96+
| Color | `app:backgroundColor` <br> `app:badgeTextColor` |
97+
| Width | `app:badgeWidth` <br> `app:badgeWithTextWidth` |
98+
| Height | `app:badgeHeight` <br> `app:badgeWithTextHeight` |
99+
| Shape | `app:badgeShapeAppearance` <br> `app:badgeShapeAppearanceOverlay` <br> `app:badgeWithTextShapeAppearance` <br> `app:badgeWithTextShapeAppearanceOverlay` |
100+
| Label | `app:badgeText` (for text) <br> `app:number` (for numbers) |
101+
| Label Length | `app:maxCharacterCount` (for all text) <br> `app:maxNumber` (for numbers only) |
102+
| Label Text Color | `app:badgeTextColor` |
103+
| Label Text Appearance | `app:badgeTextAppearance` |
104+
| Badge Gravity | `app:badgeGravity` |
105+
| Offset Alignment | `app:offsetAlignmentMode` |
106+
| Horizontal Padding | `app:badgeWidePadding` |
107+
| Vertical Padding | `app:badgeVerticalPadding` |
108+
| Large Font Vertical Offset| `app:largeFontVerticalOffsetAdjustment` |
109+
| Auto Adjust | `app:autoAdjustToWithinGrandparentBounds` |
108110

109111
**Note:** If both `app:badgeText` and `app:number` are specified, the badge label will be `app:badgeText`.
110112

docs/components/Carousel.md

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ page.
2828

2929
Carousel is built on top of `RecyclerView`. To learn how to use `RecyclerView` to display a list of items, please see [Create dynamic lists with RecyclerView](https://developer.android.com/develop/ui/views/layout/recyclerview).
3030

31-
## Multi-browse carousels
32-
33-
A multi-browse carousel allows quick browsing of many small items, like a photo thumbnail gallery. A start-aligned, multi-browse carousel is the default carousel.
34-
35-
To turn a horizontal list into a multi-browse carousel, first wrap your `RecyclerView`'s item layout in a `MaskableFrameLayout`. `MaskableFrameLayout` is a `FrameLayout` that is able to mask (clip) itself, and its children, to a percentage of its width. When a mask is set to 0%, the the entire view is visible in its original, "unmaksed" width. As a mask approaches 100%, the edges of the view begin to crop in towards the center, leaving a narrower and narrower sliver of the original view visible. Carousel masks and unmasks items as they are scrolled across the viewport to create a stylized look and feel.
31+
To turn a horizontal list into a carousel, first wrap your `RecyclerView`'s item layout in a `MaskableFrameLayout`. `MaskableFrameLayout` is a `FrameLayout` that is able to mask (clip) itself, and its children, to a percentage of its width. When a mask is set to 0%, the the entire view is visible in its original, "unmasked" width. As a mask approaches 100%, the edges of the view begin to crop in towards the center, leaving a narrower and narrower sliver of the original view visible. Carousel masks and unmasks items as they are scrolled across the viewport to create a stylized look and feel.
3632

3733
```xml
3834
<com.google.android.material.carousel.MaskableFrameLayout
@@ -71,7 +67,56 @@ Next, set your `RecyclerView`s layout manager to a new `CarouselLayoutManager`.
7167
carouselRecyclerView.setLayoutManager(CarouselLayoutManager())
7268
```
7369

74-
These are the basic steps to create a carousel with large items at the start of the list followed by medium and small items, depending on the size of the `RecyclerView` container.
70+
These are the basic steps to create a carousel. The look of the carousel depends
71+
on which carousel strategy you are using; you can have a
72+
[multi-browse strategy](#multi-browse-strategy) or
73+
[hero strategy](#hero-strategy).
74+
75+
## Multi-browse strategy
76+
77+
![A contained, multi-browse Carousel](assets/carousel/multibrowse.png)
78+
79+
A multi-browse strategy allows quick browsing of many small items, like a photo
80+
thumbnail gallery. A start-aligned, multi-browse strategy is the default
81+
strategy for the carousel.
82+
83+
With a multi-browse strategy, large items are at the start of the list followed
84+
by medium and small items, depending on the size of the `RecyclerView`
85+
container.
86+
87+
You can use the multi-browse strategy by passing in no arguments to the
88+
CarouselLayoutManager constructor: `new CarouselLayoutManager()`.
89+
90+
## Hero strategy
91+
92+
![A contained, hero Carousel](assets/carousel/hero.png)
93+
94+
A hero strategy highlights large content, like movies and other media, for more
95+
considered browsing and selection. It draws attention and focus to a main
96+
carousel item while hinting at the next item in line.
97+
98+
With a hero strategy, typically there is one large item is at the start of the
99+
list followed by a small item. When there is one large item, the large item
100+
takes up the entire size of the `RecyclerView` container, save some space for
101+
the small item.
102+
103+
There may be more than one large item depending on the dimensions of the
104+
carousel. On a horizontal carousel, the width of a large item will maximally be
105+
twice its height, and vice versa for vertical carousels. More large items are
106+
added when the maximum large item size has been reached. For example, horizontal
107+
carousels with `match_parent` as the width will have more and more large items
108+
as the screen size grows.
109+
110+
You can use the hero strategy by passing in the strategy to the
111+
CarouselLayoutManager constructor: `new CarouselLayoutManager(new
112+
HeroStrategy())`.
113+
114+
With the hero strategy, it is recommended to use the `CarouselSnapHelper` to snap to the nearest item like so:
115+
116+
```
117+
SnapHelper snapHelper = new CarouselSnapHelper();
118+
snapHelper.attachToRecyclerView(carouselRecyclerView);
119+
```
75120

76121
## Customizing carousel
77122

0 commit comments

Comments
 (0)