Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ざっくり Jetpack Compose / Cookpad.apk #3
Search
star_zero
July 23, 2019
Programming
2
1.1k
ざっくり Jetpack Compose / Cookpad.apk #3
star_zero
July 23, 2019
Tweet
Share
More Decks by star_zero
See All by star_zero
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1.4k
Jetpack Compose の Side-effect を使いこなす / DroidKaigi 2023
star_zero
5
6.3k
Android 14 新機能 / Android 14 Meetup Nagoya
star_zero
1
620
Android 14 と Predictive back gesture / Shibuya.apk #42
star_zero
0
410
Coroutines Test 入門 / Android Test Night #8
star_zero
2
1.2k
What's new in Jetpack / I/O Extended Japan 2022
star_zero
1
650
Kotlin 2021 Recap / DevFest 2021
star_zero
3
1.3k
Kotlin Symbol Processing (KSP) を使ったコード生成 / DroidKaigi 2021
star_zero
2
5.2k
What's new Android 12
star_zero
0
580
Other Decks in Programming
See All in Programming
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
20
11k
Kiroで始めるAI-DLC
kaonash
2
590
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
140
Ruby Parser progress report 2025
yui_knk
1
440
Tool Catalog Agent for Bedrock AgentCore Gateway
licux
6
2.4k
GitHubとGitLabとAWS CodePipelineでCI/CDを組み比べてみた
satoshi256kbyte
4
230
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
🔨 小さなビルドシステムを作る
momeemt
4
680
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
440
為你自己學 Python - 冷知識篇
eddie
1
350
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
690
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
13k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
The Cult of Friendly URLs
andyhume
79
6.6k
RailsConf 2023
tenderlove
30
1.2k
Code Reviewing Like a Champion
maltzj
525
40k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Facilitating Awesome Meetings
lara
55
6.5k
The Language of Interfaces
destraynor
161
25k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Rails Girls Zürich Keynote
gr2m
95
14k
Transcript
ざっくり Jetpack Compose Cookpad.apk #3 2019/07/23
About me •Kenji Abe •メディアプロダクト開発部 •cookpadLive, storeTV •Twitter: @STAR_ZERO
⚠注意⚠ まだAlphaにもなってないので、 今後変更されると思います。 2019/07/20のコードでやっています。
Jetpack Compose
Jetpack Compose •Google I/O 2019で発表 •UIを宣言的に書いてく •Kotlinを使う •React, Litho, Vue.js,
Flutterみたいな感じ
Jetpack Composeで アプリを作ってみた https://github.com/STAR-ZERO/GithubCompose
Hello World
Hello World override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent {
MaterialTheme { Text(text = "Hello World") } } }
レイアウト
レイアウト MaterialTheme { Container( padding = EdgeInsets(16.dp), alignment = Alignment.TopLeft,
width = 240.dp, height = 120.dp ) { Text(text = "Hello World") } }
レイアウト MaterialTheme { Column { Row { Text(text = "123")
Text(text = "456") } Row { Text(text = "abc") Text(text = "def") } } }
レイアウト MaterialTheme { Table { for (i in 0 until
20) { tableRow { for (j in 0 until 2) { Padding(16.dp) { Text(text = "Cell $i - $j") } } } } } }
ステート
ステート Column { val counter = +state { 0 }
Text(text = "count = ${counter.value}") Button( text = "Button", onClick = { counter.value++ } ) }
ステート Column { val flag = +state { false }
if (flag.value) { Text(text = "Jepack") } else { Text(text = "Compose") } Button( text = "Button", onClick = { flag.value = !flag.value } ) }
Commit Scope? (Lifecycle?)
Commit Scope Column { +onActive { } // 最初の1回 +onCommit
{ // 描画されるたび onDispose { } // 破棄されるとき } val flag = +state { false } if (flag.value) { Container { +onCommit { onDispose { } } } } else { // ... } }
まとめ
まとめ •直感的でよさそう ‣ でも、すべてJetpack Composeはツライかも? •ステートやライフサイクルは今までと異なるので注意 ‣ 設計どうしよう
まとめ •ただし、今やるべきではない ‣ Alphaにもなってないので当然 ‣ 正式リリースまではだいぶ時間かかりそうな印象
ありがとうございました