-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Golden Tiles samples #450
Conversation
- replacing functions and utilities which are now in Horologist - note: this is using a snapshot androidx repo so we can take advantage of changes in tiles-material-components - TODO: add remaining Golden Tiles, and remove component audit
.setPrimaryChipContent( | ||
CompactChip.Builder(context, "More", chipClickable, deviceParameters) | ||
.setChipColors( | ||
ChipColors( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bordering on the don't review for content, but would it be helpful to implement these designs using themes using Colors? then using primary or secondary ChipColors factories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment for this elsewhere. I'm not sure themes for tiles is worth it - as I was implementing all of these, I found it easier to specify colors explicitly.
In a real project, I imagine it'll be even less worth it:
- a real project won't have many tiles
themes aren't directly reusable between Compose/this- even if they were reusable, it's not guaranteed that we'd want the same combination of colors
- tiles (/wear?) is always dark mode and doesn't support dynamic theming (afaik)
I'm not sure what it provides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link you provided here to an example project does help show some utility - https://github.com/yschimke/rememberwear/blob/main/wear/src/main/kotlin/com/google/wear/soyted/tile/RememberWearTileRenderer.kt#L116
I think we should not introduce themes for the Golden Tiles from themes because it'll only serve to showcase the overhead without any of the benefit; unlike your RememberTheMilk project which is sharing a theme with the main app, each Golden Tile is distinct and has its own theme.
There's an example of a theme being created in ComponentAudit.kt
which we can leave as-is / improve, since it's used throughout the whole file (there's no requirements/designs for different colors).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IF we want people to be able to take these tiles and copy and paste them, I think it's useful. Or maybe a library of reference tile designs, "templates" that we provide. But your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it for now and we'll revisit if there's feedback. I think these samples should facilitate understanding and we shouldn't necessarily be encouraging copy and pasting.
Direction looks, great. Would you consider using the Horologist TileRenderer abstraction, should give a nice clean separation for the data of each tile. But can understand why you may not. |
WearTilesKotlin/app/src/debug/java/com/example/wear/tiles/golden/GoldenTilesPreviews.kt
Outdated
Show resolved
Hide resolved
fun Goal() { | ||
val context = LocalContext.current | ||
LayoutRootPreview( | ||
Goal.layout(context, context.deviceParams(), steps = 5168, goal = 8000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any parameter that could change if used as a real tile is exposed.
) { | ||
addIdToImageMapping( | ||
Workout.BUTTON_1_ICON_ID, | ||
drawableResToImageResource(R.drawable.ic_run_24) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can/should we add an ext function to whatever receiver this is?
Foo.addIdToImageMapping(String, @DrawableRes Int)
drawableResToImageResource(@DrawableRes Int)
exists in Horologist already. Is the Foo
only used for preview or is it the same code that would be used in a renderer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea.
~ limitations under the License. | ||
--> | ||
<resources> | ||
<color name="yellow">#FFCF48</color> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file will likely be deleted since we're moving away from color resources in Compose-era.
WearTilesKotlin/app/src/main/java/com/example/wear/tiles/golden/Workout.kt
Show resolved
Hide resolved
Will be able to see when I move onto updating the samples themselves 👍 At the moment, we have 3 samples to showcase 3 layouts which seems like a lot of overhead for showcasing layouts. When this is merged, we'll have all the Golden Tile layouts, so we can replace the samples so that they use the existing layouts. They can be used to demonstrate common/complex use cases around data stuff, not layouts. |
@@ -63,29 +63,25 @@ android { | |||
} | |||
|
|||
dependencies { | |||
implementation libs.horologist.compose.layout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just alphabetized
Merging this for now so if people come looking for examples following our talk, there's something in the main repo. Will update as necessary following newer snapshots, and of course along with the beta/stable updates. |
This PR adds implementations for each of the Golden Tiles from the Wear Tiles Design Kit
ComponentAudit.kt
should only show individual components (e.g. Chip). Layouts will all be covered byGoldenTilesPreviews.kt