העברה למרחבי שמות של ProtoLayout

החל מגרסה 1.2, רוב ממשקי ה-API של פריסת המשבצות נמצאים במרחב השמות androidx.wear.protolayout. כדי להשתמש בממשקי ה-API העדכניים ביותר, צריך לבצע את שלבי ההעברה הבאים בקוד.

עדכון יחסי התלות

בקובץ ה-build של מודול האפליקציה, מבצעים את השינויים הבאים:

מגניב

  // Remove
  implementation 'androidx.wear.tiles:tiles-material:version'

  // Include additional dependencies
  implementation "androidx.wear.protolayout:protolayout:1.2.1"
  implementation "androidx.wear.protolayout:protolayout-material:1.2.1"
  implementation "androidx.wear.protolayout:protolayout-expression:1.2.1"

  // Update
  implementation "androidx.wear.tiles:tiles:1.4.1"

Kotlin

  // Remove
  implementation("androidx.wear.tiles:tiles-material:version")

  // Include additional dependencies
  implementation("androidx.wear.protolayout:protolayout:1.2.1")
  implementation("androidx.wear.protolayout:protolayout-material:1.2.1")
  implementation("androidx.wear.protolayout:protolayout-expression:1.2.1")

  // Update
  implementation("androidx.wear.tiles:tiles:1.4.1")

עדכון מרחבי שמות

מבצעים את העדכונים הבאים בקובצי הקוד של האפליקציה שמבוססים על Kotlin ועל Java. לחלופין, אפשר להריץ את הסקריפט לשינוי שם של מרחב שמות.

  1. מחליפים את כל הייבוא של androidx.wear.tiles.material.* ב-androidx.wear.protolayout.material.*. צריך להשלים את השלב הזה גם בספרייה androidx.wear.tiles.material.layouts.
  2. מחליפים את רוב ייבוא ה-androidx.wear.tiles.* ב-androidx.wear.protolayout.*.

    הייבוא של androidx.wear.tiles.EventBuilders,‏ androidx.wear.tiles.RequestBuilders,‏ androidx.wear.tiles.TileBuilders ו-androidx.wear.tiles.TileService לא ישתנה.

  3. שינוי השם של כמה שיטות שהוצאו משימוש מהכיתות TileService ו-TileBuilder:

    1. TileBuilders: getTimeline() עד getTileTimeline() ו-setTimeline() עד setTileTimeline()
    2. TileService: onResourcesRequest() עד onTileResourcesRequest()
    3. RequestBuilders.TileRequest: getDeviceParameters() עד getDeviceConfiguration(), setDeviceParameters() עד setDeviceConfiguration(), getState() עד getCurrentState(), setState() עד setCurrentState()