visible true

技術的なメモを書く

Safe Args PluginでParcelable Arrayを使いたい時は型の末尾に[]って書けばいいらしい

ObjectArrayTypeとputParcelableArray

実装を読んでみるとObjectArrayTypeという型があり、putParcelableArraygetParcelableArrayマッピングしてるぽいことがわかる。

https://android.googlesource.com/platform/frameworks/support/+/9d3737306a6092c8ce8a98163b3a8070f0dcab7e/navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Types.kt#152

型の末尾の[]をチェック

https://android.googlesource.com/platform/frameworks/support/+/9d3737306a6092c8ce8a98163b3a8070f0dcab7e/navigation/safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Types.kt#47

あとここで、型の末尾に[]があるかチェックしている。

なのでこんな感じに書けばよい。

<argument
  android:name="authors"
  app:argType="jp.dip.sys1.aozora.models.AuthorCard[]" />

AuthorCardはもちろんParcelableでなければならない。

おわりに

うしさんありがとう。

Pass data between destinations  |  Android Developersには、

You can check Array to indicate that the argument should be an array of the selected Type value.

と書いてあるので、いずれAndroid Studio上でもarrayかどうかのチェックをUIで設定できるようになるはず(canaryだと動いてそう)。