-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Carousel] Updated MultiBrowseCarouselStrategy to find best arrangmen…
…ts using a cost function This changes the way arrangements are found by: * Finding all possible arrangements of items * Sort the arrangement candidates using a cost function that optimizes for total space fit, large item size retention, and adherence to other input params * Fit and use the top arrangement to work within the carousel's available space PiperOrigin-RevId: 522568015 (cherry picked from commit 0184b5b)
- Loading branch information
1 parent
48fd6d2
commit 93913a4
Showing
7 changed files
with
786 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
catalog/java/io/material/catalog/carousel/res/layout/cat_carousel_item_narrow.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2023 The Android Open Source Project | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<com.google.android.material.carousel.MaskableFrameLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/carousel_item_container" | ||
android:layout_width="130dp" | ||
android:layout_height="match_parent" | ||
android:layout_marginStart="4dp" | ||
android:layout_marginEnd="4dp" | ||
android:foreground="?attr/selectableItemBackground" | ||
app:shapeAppearance="?attr/shapeAppearanceCornerExtraLarge"> | ||
<ImageView | ||
android:id="@+id/carousel_image_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:scaleType="centerCrop" | ||
tools:ignore="ContentDescription" /> | ||
</com.google.android.material.carousel.MaskableFrameLayout> |
Oops, something went wrong.