Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ウォッチフェイス作ってみた shibuya.apk #41 @Kaito-Dogi

ウォッチフェイス作ってみた shibuya.apk #41 @Kaito-Dogi

2023/04/21 開催の shibuya.apk にて登壇させていただきました。

-----

ウォッチフェイスを作ってみました!

Kaito-Dogi

April 21, 2023
Tweet

More Decks by Kaito-Dogi

Other Decks in Programming

Transcript

  1. コンポーネント
 ❏ テキスト
 ❏ 静的な標準テキスト
 ❏ 動的なデータテキスト(タグ式を使用) 
 ❏ 図形(楕円・長方形など)


    ❏ 画像・アニメーション
 ❏ AGIF・Lottie・WebP の再生(マルチメディア) 
 ❏ アナログ時計・デジタル時計
 ❏ プログレスバー

  2. アニメーション
 ❏ 複数の画像をパラパラマンガのように再生
 ❏ 画像ごとに Frame を設定
 ❏ メイン画面で再生して確認可能
 


    ❏ AGIF・Lottie・WebP のような、
 既にアニメーション化されている画像は
 マルチメディアで再生!

  3. class CustomWatchFaceService : WatchFaceService() { override fun createUserStyleSchema(): UserStyleSchema =

    // ... override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... }
  4. class CustomWatchFaceService : WatchFaceService() { override fun createUserStyleSchema(): UserStyleSchema =

    // ... override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... } WatchFaceService
 を継承

  5. class CustomWatchFaceService : WatchFaceService() { override fun createUserStyleSchema(): UserStyleSchema =

    // ... override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... } 3つのメソッドを
 override

  6. class CustomWatchFaceService : WatchFaceService() { override fun createUserStyleSchema(): UserStyleSchema =

    // ... override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... } スキーマの設定
 (色・分針の長さなど)

  7. class CustomWatchFaceService : WatchFaceService() { override fun createUserStyleSchema(): UserStyleSchema =

    // ... override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... } Complication スロット
 の初期化

  8. class CustomWatchFaceService : WatchFaceService() { override fun createUserStyleSchema(): UserStyleSchema =

    // ... override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... } ウォッチフェイスを
 レンダリング(描画)

  9. 参考記事
 ❏ Build watch faces | Android Developers 
 https://developer.android.com/training/wearables/watch-faces

    
 ❏ Watch Face Studio | Android Developers 
 https://developer.android.com/training/wearables/wfs 
 ❏ WatchFace Sample (Kotlin) 
 https://github.com/android/wear-os-samples/tree/main/WatchFaceKotlin 
 ❏ Watch Face Studio | Samsung Developers 
 https://developer.samsung.com/watch-face-studio/overview.html 
 ❏ DroidKaigi 2022 - Introduction to Wear OS Application Development | Ryo Yamazaki 
 https://youtu.be/o0HhsnVAGNA 
 ❏ Watch Face Studio でウォッチフェイスを作ろう 
 https://funnelbit.hatenablog.com/entry/2022/11/28/150138 
 ❏ [Android] Watch Faceをささっと作成 
 https://cocoamix.jp/archives/9482