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
7k
Android 14 新機能 / Android 14 Meetup Nagoya
star_zero
1
660
Android 14 と Predictive back gesture / Shibuya.apk #42
star_zero
0
480
Coroutines Test 入門 / Android Test Night #8
star_zero
2
1.3k
What's new in Jetpack / I/O Extended Japan 2022
star_zero
1
700
Kotlin 2021 Recap / DevFest 2021
star_zero
3
1.4k
Kotlin Symbol Processing (KSP) を使ったコード生成 / DroidKaigi 2021
star_zero
2
5.3k
What's new Android 12
star_zero
0
620
Other Decks in Programming
See All in Programming
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
370
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
2
150
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
370
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
3
960
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
0
240
色即是空、空即是色、データサイエンス
kamoneggi
1
110
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
190
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
120
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
0
260
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.7k
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
460
Agentic UI beyond Chats Architecture Patterns & Open Standards @ngMunich 05/2026
manfredsteyer
PRO
0
110
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Abbi's Birthday
coloredviolet
2
7.6k
So, you think you're a good person
axbom
PRO
2
2k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
350
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
170
Believing is Seeing
oripsolob
1
130
We Are The Robots
honzajavorek
0
230
YesSQL, Process and Tooling at Scale
rocio
174
15k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
800
Agile that works and the tools we love
rasmusluckow
331
21k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
300
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
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にもなってないので当然 ‣ 正式リリースまではだいぶ時間かかりそうな印象
ありがとうございました