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
1.1k
2
Share
ざっくり Jetpack Compose / Cookpad.apk #3
star_zero
July 23, 2019
More Decks by star_zero
See All by star_zero
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1.6k
Jetpack Compose の Side-effect を使いこなす / DroidKaigi 2023
star_zero
5
6.9k
Android 14 新機能 / Android 14 Meetup Nagoya
star_zero
1
650
Android 14 と Predictive back gesture / Shibuya.apk #42
star_zero
0
470
Coroutines Test 入門 / Android Test Night #8
star_zero
2
1.3k
What's new in Jetpack / I/O Extended Japan 2022
star_zero
1
690
Kotlin 2021 Recap / DevFest 2021
star_zero
3
1.3k
Kotlin Symbol Processing (KSP) を使ったコード生成 / DroidKaigi 2021
star_zero
2
5.3k
What's new Android 12
star_zero
0
610
Other Decks in Programming
See All in Programming
ファインチューニングせずメインコンペを解く方法
pokutuna
0
220
Understanding Apache Lucene - More than just full-text search
spinscale
0
150
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
110
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.4k
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
200
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.2k
おれのAgentic Coding 2026/03
tsukasagr
1
120
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
160
AI 開発合宿を通して得た学び
niftycorp
PRO
0
180
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
190
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
330
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
700
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Crafting Experiences
bethany
1
100
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
Facilitating Awesome Meetings
lara
57
6.8k
Technical Leadership for Architectural Decision Making
baasie
3
300
Docker and Python
trallard
47
3.8k
A Soul's Torment
seathinner
5
2.6k
Are puppies a ranking factor?
jonoalderson
1
3.2k
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にもなってないので当然 ‣ 正式リリースまではだいぶ時間かかりそうな印象
ありがとうございました