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

Wear OSアプリ開発Tips with Jetpack Compose

Wear OSアプリ開発Tips with Jetpack Compose

Engineer LT 1の発表資料です。

#EngineerLT
#WearOS
#androidjo

Kenichi Kambara

June 14, 2022
Tweet

More Decks by Kenichi Kambara

Other Decks in Technology

Transcript

  1. 2 About me ਆݪ ݈Ұ (@korodroid) •Mobile App Development •Speeches

    (e.g. 9 International confs.) •Writings (e.g. 6 Dev Books) •[Of fi cial] Evangelist at NTT TechnoCross •[Private] iplatform.org
  2. Agenda •Wear OS ͷ࠷৽τϐοΫ(։ൃऀ޲͚) •Wear OS ΞϓϦ։ൃTips with Jetpack Compose

    Source: Google I/O 2022 Keynote / Developer Keynote / Wear OS Session Android Developers Blog
  3. Compose for Wear OS ࣮૷ྫ(͋ͱͰվળ͍͖ͯ͠·͢) @Composable fun ContactsScreenV1() { LazyColumn

    { item { ListHeader { Text(text = "Contacts") } } items(20) { Chip( icon = { Icon( Icons.Rounded.Face, contentDescription = "Contacts", ) }, label = { Text("HogeHoge Tarou $it") }, colors = ChipDefaults.primaryChipColors(), onClick = { }, ) } } } 
  4. [UIվળͷલʹ…]Wear OSͱMobileͷҧ͍(ྫ)  Wear OS 
 (androidx.wear.*) Mobile 
 (androidx.*)

    androidx.wear.compose:compose-material androidx.wear.compose:compose-navigation androidx.compose.foundation:foundation androidx.wear.compose:compose-foundation androidx.compose.material:material androidx.navigation:navigation-compose androidx.compose.foundation:foundation ref: https://developer.android.com/training/wearables/compose
  5. @Composable fun ContactsScreenV2() { ScalingLazyColumn { item { ListHeader {

    Text(text = "Contacts") } } items(20) { Chip( icon = { Icon( Icons.Rounded.Face, contentDescription = "Contacts", ) }, label = { Text("HogeHoge Tarou $it") }, colors = ChipDefaults.primaryChipColors(), onClick = { }, ) } } }  Tips3: UIվળྫ1(ScalingLazyColumn΁ͷஔ͖׵͑)
  6. @OptIn(ExperimentalWearMaterialApi::class) @Composable fun ContactsScreenV3() { val listState = rememberScalingLazyListState() Scaffold(

    timeText = { if (!listState.isScrollInProgress) { TimeText() } }, vignette = { Vignette( vignettePosition = VignettePosition.TopAndBottom ) }, positionIndicator = { PositionIndicator( scalingLazyListState = listState, ) } ) { ScalingLazyColumn(state = listState) { // লུ } }  Tips4: UIվળྫ2(Scaffoldͷ׆༻)
  7. Reference  •Google I/O 2022 Keynote / Developer Keynote /

    Session 
 https://io.google/2022 
 •Announcing Compose for Wear OS Beta! 
 https://android-developers.googleblog.com/2022/05/ announcing-compose-for-wear-os-beta.html •Codelabs (Wear OS) 
 https://codelabs.developers.google.com/?cat=wearos
  8. Please let me know if you have any requests 


    such as technical speeches, technical writings and so on. http://www.linkedin.com/in/korodroid Thank you so much http://fb.com/kanbara.kenichi @korodroid