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
Search
TakuSemba
May 21, 2019
Technology
3.7k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Jetpack Compose
TakuSemba
May 21, 2019
More Decks by TakuSemba
See All by TakuSemba
Customize & Debug ExoPlayer @droidkaigi 2020
takusemba
0
2.1k
Protobuf in Kotlin
takusemba
2
2k
Single Activity with MVVM
takusemba
4
1.4k
KotlinConf Report @ca.kt#7
takusemba
2
500
Request in a QUIC way @shibuya.apk#28
takusemba
2
1.1k
Lint for Kotlin @R.kt#3
takusemba
3
1.6k
Auto Release @potatochips#48
takusemba
1
1.3k
Media streaming on Android @droidkaigi 2018
takusemba
6
8.3k
gRPC on Android @DroidconSF Report
takusemba
1
640
Other Decks in Technology
See All in Technology
AI、CDK と協働する Full TypeScript アプリケーション開発 / Full TypeScript Application with AI and CDK
geekplus_tech
2
270
「早く出す」より「事業に効く」 ── 顧客の業務サイクルから逆算するAI時代の二重ループ開発と「変化の設計者」 / devsumi2026
rakus_dev
1
290
Data + AI Summit 2026 イベントレポート: 「AIがビジネスで意思決定するデータ基盤」へ
nek0128
0
220
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
370
DatabricksにおけるMCPソリューション
taka_aki
1
260
AI Agent SaaS を支える自社仮想化基盤への挑戦と実運用 / ai-agent-saas-virtualization
flatt_security
3
4k
CDKで書くECSのベストプラクティス、 改めて考え直す2026 #cdkconf2026
makies
1
610
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
5.6k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
110k
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
14
2.1k
はじめてのWDM
miyukichi_ospf
1
150
実装だけじゃない! CCA-F取得エンジニアが教えるClaude Code開発プロセス活用術
diggymo
2
800
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5.1k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
380
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
How GitHub (no longer) Works
holman
316
150k
We Are The Robots
honzajavorek
0
280
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
It's Worth the Effort
3n
188
29k
Producing Creativity
orderedlist
PRO
348
40k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Transcript
+FUQBDL$PNQPTF TakuSemba CyberAgent.Inc
@takusemba https://github.com/TakuSemba
+FUQBDL$PNQPTF
+FUQBDL$PNQPTF https://www.youtube.com/watch?v=VsStyq4Lzxo
@Composable fun Greeting(name: String) { Text ("Hello $name!") }
@Composable fun Greeting(name: String) { Text ("Hello $name!") }
None
None
What’s Composable
What’s Composable ɾA new set of Jetpack UI widgets
What’s Composable ɾA new set of Jetpack UI widgets ɾA
kotlin compiler plugin
What’s Composable ɾA new set of Jetpack UI widgets ɾA
kotlin compiler plugin ɾFully compatible with your existing app/code
What’s Composable ɾA new set of Jetpack UI widgets ɾA
kotlin compiler plugin ɾFully compatible with your existing app/code ɾExperimental
@Composable
Text(“Hello world!”)
@Composable fun Greeting(name: String) { Text("Hello $name!") }
@Composable fun Greeting(name: String) { Text("Hello $name!") } class ComposeSampleActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } }
@Composable fun Greeting(name: String) { Text("Hello $name!") } class ComposeSampleActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { CraneWrapper { Greeting("takusemba") } } } }
@Composable fun Greeting(name: String) { Text("Hello $name!") } class ComposeSampleActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { CraneWrapper { Greeting("takusemba") } } } }
@Composable fun Greeting(name: String) { Text("Hello $name!") } class ComposeSampleActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { CraneWrapper { Greeting("takusemba") } } } }
@Composable fun Greeting(name: String) { Text("Hello $name!") } class ComposeSampleActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { CraneWrapper { Greeting("takusemba") } } } }
class ComposeSampleActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) setContent { CraneWrapper { MaterialTheme { Greeting("takusemba") } } } } } @Composable fun Greeting(name: String) { Text("Hello $name!") }
@Composable fun Greeting(name: String) { Text(text = "Hello $name!", style
= +themeTextStyle { h5 }) } class ComposeSampleActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { CraneWrapper { MaterialTheme { Greeting("takusemba") } } } } }
@Composable fun <T> ScrollingList( data: List<T>, body: @Composable()(T) -> Unit
) { // ... body(item) // ... }
@Composable fun <T> ScrollingList( data: List<T>, body: @Composable()(T) -> Unit
) { // ... body(item) // ... } @Composable fun NewsFeed(stories: List<Story>) { ScrollingList(stories) { story -> StoryWidget(story) } }
@Composable fun <T> ScrollingList( data: List<T>, body: @Composable()(T) -> Unit
) { // ... body(item) // ... } @Composable fun MenuList(items: List<Item>) { ScrollingList(items) { item -> when (item) { is FoodItem -> FoodWidget(item) is DrinkItem -> DrinkWidget(item) } } }
@Model
@Composable fun Greeting(name: String) { Text("Hello $name!") }
@Composable fun Greeting(name: String) { val count = +state {
0 } Column { Button(text = "greet", onClick = { count.value++ }) Text(text = "$name greeted ${count.value} times") } }
@Composable fun Greeting(name: String) { val count = +state {
0 } Column { Button(text = "greet", onClick = { count.value++ }) Text(text = "$name greeted ${count.value} times") } }
@Composable fun Greeting(name: String) { val count = +state {
0 } Column { Button(text = "greet", onClick = { count.value++ }) Text(text = "$name greeted ${count.value} times") } }
@Model class GreetCounter(var count: Int) { fun add() { count++
} fun substract() { count-- } } @Composable fun Greeting(name: String) { val count = +state { 0 } Column { Button(text = "greet", onClick = { count.value++ }) Text(text = "$name greeted ${count.value} times") } }
@Model class GreetCounter(var count: Int) { fun add() { count++
} fun substract() { count-- } } @Composable fun Greeting(name: String) { val counter = +memo { GreetCounter(0) } Column { Button(text = "greet", onClick = { count.add() }) Text(text = "$name greeted ${count.count} times") } }
@Composable fun Greeting(name: String) { val counter = +memo {
GreetCounter(0) } Column { Button(text = "greet", onClick = { count.add() }) Text(text = "$name greeted ${count.count} times") } } @Model class GreetCounter(var count: Int) { fun add() { count++ } fun substract() { count-- } }
@Model class LoginState(var username: String, var password: String) { val
valid: Boolean get() = username.isNotEmpty() && password.isNotEmpty() }
@Model class LoginState(var username: String, var password: String) { val
valid: Boolean get() = username.isNotEmpty() && password.isNotEmpty() } @Composable fun LoginScreen(onClick: () -> Unit) { val model = +memo { LoginState() } EditText( text=model.username, onTextChange={ text -> model.username = text } ) EditText( text=model.password, onTextChange={ text -> model.password = text } ) Button(text="Login", enabled=model.valid, onClick={ onClick() }) }
@Model class LoginState(var username: String, var password: String) { val
valid: Boolean get() = username.isNotEmpty() && password.isNotEmpty() } @Composable fun LoginScreen(onClick: () -> Unit) { val model = +memo { LoginState() } EditText( text=model.username, onTextChange={ text -> model.username = text } ) EditText( text=model.password, onTextChange={ text -> model.password = text } ) Button(text="Login", enabled=model.valid, onClick={ onClick() }) }
@GenerateView
@Composable fun Greeting(name: String) { Text ("Hello $name!") }
@Composable @GenerateView fun Greeting(name: String) { Text ("Hello $name!") }
@Composable @GenerateView fun Greeting(name: String) { Text ("Hello $name!") }
// In your existing xml <GreetingView app:name="takusemba" />
@Composable @GenerateView fun Greeting(name: String) { Text ("Hello $name!") }
// In your existing xml <GreetingView app:name="takusemba" /> // find view by Id val greeting = findViewById(R.id.greeting)
@Discussion
None
+FUQBDL$PNQPTF https://github.com/takusemba https://twitter.com/takusemba