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
2.1k
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.2k
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
650
Other Decks in Technology
See All in Technology
オートロックマンションなのに、各部屋は施錠なし!? 攻撃者が組織内ネットワークで大暴れする理由 / The Front Door Is Locked, but the Rooms Are Wide Open: Why Attackers Move Freely Inside Enterprise Networks
nttcom
1
1.6k
FORENSIA: ローカルLLMフォレンジックハーネス
sumeshi
2
350
モダンフロントエンド 開発研修
recruitengineers
PRO
3
560
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
670
認知負荷をGemini で溶かす — GKE 基盤「Orbit」における AI エージェントの実践
sansantech
PRO
1
270
Cursor Meetup Sapporo - Cursor物語 続編
cocacola917
0
140
AWS ネットワーク構築でハマった(ハマりかけた) 5選とそこから得た教訓
nagisa53
4
200
Goでデータパイプラインを作ろう
sansantech
PRO
0
360
toio・myCobotでフィジカルAIっぽいことを行うための検討(とりあえず調査) / フィジカルAI LT(IoTLTによる開催)
you
PRO
0
300
【CEDEC2026】コードレビュー支援ツール開発から学ぶ:LLMを用いた業務システムの実践的な運用設計と誤出力対策
cygames
PRO
0
630
Redmine 7.0 新機能・機能強化解説(OSC2026京都ダイジェスト版)
vividtone
1
210
【CEDEC2026】ゲームシナリオライターを支援するAIツール開発の実践 ― 設計とプロンプトの工夫 ―
cygames
PRO
1
770
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
210
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Un-Boring Meetings
codingconduct
0
380
Accessibility Awareness
sabderemane
1
170
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
The browser strikes back
jonoalderson
0
1.5k
How to Ace a Technical Interview
jacobian
281
24k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
340
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