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
MUSUBI 田中裕一『AIと共に行う「しごとのリデザイン」- スモールバックオフィス編』AI Ops Lab #4
musubi
0
170
失敗を経て、Harness Engineering で 大切にしたいことを考える / Learning from Failure: What Matters in Harness Engineering
bitkey
PRO
1
370
Android の公式 Skill / Android skills
yanzm
0
140
人材育成分科会.pdf
_awache
4
250
FinOps × AIエージェントで実現する コストインシデントの自動調査
oasis1994liveforever
0
140
200個のGitHubリポジトリを横断調査したかった
icck
0
130
RAG を使わないという選択肢
tatsutaka
1
230
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
1.1k
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.3k
入門!AWS Blocks
ysuzuki
1
120
脆弱性対応、どこで線を引くか
rymiyamoto
1
390
AIっぽい文章を採点して人間らしく直すアプリを作ってみた
yama3133
2
170
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Are puppies a ranking factor?
jonoalderson
1
3.5k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
WENDY [Excerpt]
tessaabrams
11
38k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
Measuring & Analyzing Core Web Vitals
bluesmoon
9
860
Writing Fast Ruby
sferik
630
63k
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