Skip to content

Instantly share code, notes, and snippets.

View NedaTop's full-sized avatar

NedaTop

View GitHub Profile
@NedaTop
NedaTop / ProtoLayoutMigration.md
Last active July 24, 2023 16:51
Tiles to ProtoLayout migration

1. Dependency update

  • Replace implementation("androidx.wear.tiles:tiles-material:<version>") with implementation("androidx.wear.protolayout:protolayout-material:1.0.0-rc01")
  • Add implementation("androidx.wear.protolayout:protolayout-expression:1.0.0-rc01") and implementation("androidx.wear.protolayout:protolayout:1.0.0-rc01")
  • Update tiles:tiles dependency to use the latest version implementation("androidx.wear.tiles:tiles:1.2.0-rc01"), and it should stay for tiles only classes.

2. Code update

Use the script we provided to update your project's imports from Tiles to ProtoLayout. Script can be found here or copy the snippet below:

@NedaTop
NedaTop / ProtoLayoutImportsManualRename.md
Last active July 24, 2023 16:48
Tiles to ProtoLayout imports rename

Note: There is a script available that does this for you!

To manually change imports in order to migrate from Tiles to ProtoLayout, follow:

  1. Replace all androidx.wear.tiles.material imports with the androidx.wear.protolayout.material (this includes .layouts library too)
  2. Replace all other androidx.wear.tiles imports with the androidx.wear.protolayout a. Imports for androidx.wear.tiles.EventBuilders, androidx.wear.tiles.RequestBuilders, androidx.wear.tiles.TileBuilders, androidx.wear.tiles.TileService should stay the same
  3. Rename a few methods from TileService/TileBuilder classes that have been deprecated and replaced: a. get/setTimeline to get/setTileTimeline b. onResourcesRequest to onTileResourcesRequest
@NedaTop
NedaTop / protoLayoutMigration.sh
Created July 24, 2023 16:32
Tiles to ProtoLayout migration script
#!/bin/bash
# Run this script in your projects dir to migrate from Tiles to ProtoLayout by changing the imports.
path=""
# Should be the full path to the folder with Java classes.
while getopts p:w: flag
do
case "${flag}" in