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
Android Studioプラグインを作ってみよう 〜Compose for Desktop...
Search
k-tomoyasu
October 26, 2023
Programming
1
420
Android Studioプラグインを作ってみよう 〜Compose for Desktopで始めるプラグイン開発〜
2023年10月26日(木)開催のpixiv App Nightで発表した資料です。
k-tomoyasu
October 26, 2023
Tweet
Share
More Decks by k-tomoyasu
See All by k-tomoyasu
Kotlin Multiplatform Projectで社内用APIクライアントを作る
fusuma0325
0
2k
Kotlin/Nativeで作ってみるCLI, iOSアプリ
fusuma0325
1
120
Redashアラートの最近 - カスタマイズ機能を作った話
fusuma0325
0
740
Other Decks in Programming
See All in Programming
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
5
2k
GCCのプラグインを作る / I Made a GCC Plugin
shouth
1
160
EventSourcingの理想と現実
wenas
6
2.2k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
4
2k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
4
5.4k
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
490
Realtime API 入門
riofujimon
0
140
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
190
Quine, Polyglot, 良いコード
qnighy
4
620
Tauriでネイティブアプリを作りたい
tsucchinoko
0
350
現場で役立つモデリング 超入門
masuda220
PRO
15
3.1k
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
3k
Featured
See All Featured
Fireside Chat
paigeccino
33
3k
RailsConf 2023
tenderlove
29
890
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Building an army of robots
kneath
302
42k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Building Applications with DynamoDB
mza
90
6.1k
What's new in Ruby 2.0
geeforr
343
31k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Making Projects Easy
brettharned
115
5.9k
Transcript
2023/10/26 fusuma Android StudioϓϥάΠϯΛ࡞ͬͯΈΑ͏ ʙCompose for DesktopͰ࢝ΊΔϓϥάΠϯ։ൃʙ
ࣗݾհ • fusuma(;͢·) • ϐΫγϒגࣜձࣾ • pixivίϛοΫͷAndroidΞϓϦ։ൃ
Android StudioϓϥάΠϯ • Android StudioͷػೳΛ֦ு͢Δ༷ʑͳϓϥάΠϯ͕ެ։͞Ε͍ͯΔ • ։ൃͷੜ࢈ੑΛ্ͤͯ͘͞ΕΔ X(چTwitter)MeetͷίϝϯτͰ օ͞Μ͕Α͘͏ϓϥάΠϯΛڭ͍͑ͯͩ͘͞
εΫγϣิॿͷϓϥάΠϯΛ࡞ͬͨ • Android UiTheme Screenshot • εΫϦʔϯγϣοτิॿ • ϓϧϦΫʹషΔ༻ͳͲΛఆ •
ςʔϚΓସ͑ɾεΫγϣɾϦαΠζ ΛϫϯϘλϯͰ
σϞ
ϓϥάΠϯ։ൃ͍ͯ͘͠ ※հͨ͠ϓϥάΠϯͷ࣮ͷৄࡉʹ৮Ε·ͤΜ (ίʔυGitHubʹஔ͍͍ͯ·͢) https://github.com/k-tomoyasu/Android-UiTheme-Screenshot
Android StudioϓϥάΠϯΛ࡞Γ͍ͨ • Android StudioIntelliJϕʔεͷIDE • جຊతʹIntelliJϓϥάΠϯ • ଟ͘ͷIntelliJϓϥάΠϯAndroid StudioͰͦͷ··͑Δ
• IntelliJϓϥάΠϯ։ൃͷυΩϡϝϯτΛΈͯਐΊΔ https://plugins.jetbrains.com/docs/intellij/developing-plugins.html • ͍͔ͭ͘Android Studio͚ͷઃఆ͕͋Δ • Android Studioʹґଘͨ͠ػೳ͕ͳ͚Εෆཁ
։ൃڥ • ݴޠ: Kotlin | 1.9.10 • ։ൃ: IntelliJ IDEA
(Community Edition) | IC-232.10072.27 • ಈ࡞֬ೝ: Android Studio Giraffe | 2022.3.1 Patch 2 • ϓϥάΠϯ͕Android Studioʹͳ͍ػೳʹґଘͯ͠͠·͍ͬͯͯ։ ൃதʹؾ͚Δ(σϑΥϧτͩͱಈ࡞֬ೝ࣌ʹ։ൃͰ͍ͬͯΔIDE ͕ىಈ͞ΕΔ)
ϓϩδΣΫτ࡞ • File > New > Project ͔ΒIDE PluginΛબ •
࡞ͨ͠εέϧτϯϓϩδΣΫτʹAndroid Studio͚ͷઃఆΛՃ͑Δ
resouces/META-INF/plugin.xml ϓϥάΠϯͷઃఆ
build.gradle.kts ϓϥάΠϯͷϏϧυઃఆ
version.setͱAndroid Studioͷޓੑ • ࢦఆ͢ΔIntelliJ IDEAͷόʔδϣϯλʔήοτͱͳΔAndroid Studioͱޓੑ͕͋Δͷʹ͢Δ • ઌ΄Ͳͷྫͷ version.set(“2022.3.3”) ͷ෦
• IntelliJ IDEAͱAndroid StudioͷόʔδϣϯͷରԠΛ·ͱΊͨϖʔδ͕͋Δ • ࢦఆͨ͠IDEAͷόʔδϣϯ͕Android StudioͷͲͷόʔδϣϯͱޓੑ͕͋Δ͔֬ೝͯ͠ɺόʔδϣ ϯΛ߹ΘͤΔ
ϓϥάΠϯͷಈ࡞֬ೝ • Run PluginͰϓϥάΠϯ͕Πϯετʔϧ͞ΕͨAndroid Studio͕ىಈ
None
ϓϥάΠϯΛݺͼग़͢: ActionΛྫʹ • Action: ϓϥάΠϯΛݺͼग़͢खஈͰɺ࠷Α͘ΘΕΔ • ϝχϡʔπʔϧόʔ͔Β࣮ߦ͞ΕΔΑ͏ʹઃఆͰ͖Δ • AnActionΫϥεΛܧঝͨ͠ΫϥεΛ࣮͠ɺݺͼग़͠ͷτϦΨʔΛ plugin.xmlʹఆٛ͢Δͱ͍͏ྲྀΕ
None
resouces/META-INF/plugin.xml
දࣔ͞Εͨ
ϓϥάΠϯͷUI࣮ • ϓϥάΠϯͷUI࣮ʹSwingΛ͏ • Swing: JavaͰఏڙ͞Ε͍ͯΔGUIϑϨʔϜϫʔΫ • μΠΞϩά࣮ͷྫ(࣍εϥΠυ)
None
None
SwingɺΘ͔Βͳ͍ ※ Swing͕ѱ͍Θ͚Ͱͳ͍Ͱ͢
಄Ͱհͨ͠ϓϥάΠϯͰ
͜͜ΛComposeͰ࣮ ಄Ͱհͨ͠ϓϥάΠϯͰ
ComposeͰUIΛ࣮Ͱ͖Δ
Compose for Desktop • Compose MultiplatformͷҰ෦ • Jetpack Compose ͷ
API Λ༷ʑͳϓϥοτϑΥʔϜʹద༻ • Swingͱ૬ޓӡ༻͢ΔͨΊͷAPI͕͋ΓɺΈ߹Θͤͯ͑Δ • ϓϥάΠϯͷUI࣮ʹར༻Ͱ͖Δ • SwingΛΘͳ͘ͳΔΘ͚Ͱͳ͍ • Composeͱͷ͗ͪΖΜɺSwingͷ࣮Λ͍͍ͨ໘͋Δ
None
None
None
Before: Swing
After: Compose
ϓϥάΠϯUIɺ͍͚ͦ͏ͳؾ͕͢Δ
Compose for DesktopΛ͏४උ • IntelliJͰCompose MultiplatformͷϓϥάΠϯΛΠϯετʔϧ • Preview͕͑Δ(ͨͩ͠Previewͷߋ৽खಈ)
ґଘؔͷهड़ build.gradle.kts
ComposeͰ։ൃ͢Δ४උ͕Ͱ͖ͨ
IDEͷ৭ͱ߹͍ͬͯͳ͍
ͳΒจࣈΛന͘
จࣈΛന͘……
IDEͷ৭ʹద߹ͤ͞Δ࣮
None
None
࣮ͨ͠ThemeΛద༻
ComposeͰ։ൃ͢Δ४උ͕Ͱ͖ͨ
ϓϥάΠϯؔ࿈APIΛௐΔ • UI͕Composeͩͱͯ͠ɺػೳͷ࣮͢ΔʹϓϥάΠϯؔ࿈ͷAPIʹ ͍ͭͯௐΔඞཁ͕͋Δ • υΩϡϝϯτ͔Β୳͢……͚ͩͩͱେม • ࢀߟʹͳΔίʔυΛ୳͢ • Γ͍ͨ͜ͱʹ͍ۙطଘͷϓϥάΠϯ͔Β୳͢
• Android Studioͷ࣮͔Β୳͢
• ϓϥάΠϯͷઃఆը໘ʹ͋ΔϦϯΫ͔ΒḷΔͷָ͕ طଘͷϓϥάΠϯ͔Β୳͢
ιʔείʔυ͕ެ։͞Ε͍ͯͨΒɺ͔͜͜ΒḷΓண͚Δ
Android Studioͷ࣮͔Β୳͢ • Android Studioʹόϯυϧ͞Ε͍ͯΔϓϥάΠϯ͔Β୳͢ • ιʔείʔυ͕ެ։͞Ε͍ͯΔ https://github.com/JetBrains/android •
AndroidϓϥάΠϯͷґଘΛઃఆ͍ͯ͠ΔͷͰɺAndroid Studioͷ࣮ Λར༻͢Δ͜ͱͰ͖Δ
Android Studioͷ࣮͔Β୳͢ • Android StudioͷWebP ConverterΛىಈ͢Δ
Android Studioͷ࣮͔Β୳͢
ެ։ • JetBrainsͷΞΧϯτ͕ඞཁ • ࡞ۀυΩϡϝϯτͷखॱ௨ΓͰOK https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html 1. GradleλεΫbuildPluginͰΞοϓϩʔυ͢ΔzipΛੜ 2.
JetBrains Marketplaceͷϖʔδ͔Β৹ࠪఏग़ 3. ೋӦۀͷʹ৹͕ࠪྃͯ͠ެ։։࢝
ɹϓϥάΠϯ։ൃͰ Compose for DesktopΛಋೖͨ͠ॴײ
Compose for DesktopͰͷϓϥάΠϯ։ൃͷॴײ • ؾʹͳͬͨ • ϓϥάΠϯͷϑΝΠϧαΠζ͕େ͖͘ͳΔ • SwingʹރΕٕͨज़ͷ҆৺ײ͕͋Δ •
Compose for DesktopͰෆ۩߹Β͖͠ͷΛ౿ΜͩΓɺະ࣮ͷͷ͕͋ͬͨΓ • Swingͱͷ૬ޓӡ༻͕ࠓޙൃల͍͔ͯ͘͠Ͳ͏͔ • ྑ͍ • ಈతʹมԽ͢Δཁૉ͕ଟ͍UIͷ࣮ʹڧ͍ • ComposeͷࣝΛ͑Δ • ϨΠΞτͷํ๏ඪ४తͳίϯϙʔωϯτͷ͍ํ͕͔ΔϝϦοτେ͖͍ • ָ͍͠
Compose for DesktopͰͷϓϥάΠϯ։ൃͷॴײ • ߴ͍҆ఆੑଟ͘ͷϢʔβʔʹΘΕΔͷΛٻΊΔͳΒؾ߹͕ඞཁͦ͏ • ಛʹUI͕؆ૉͰ͋ΕSwing͕ແ • ComposeΛ͍͍ͨؾ͕࣋ͪڧ͍/ͱΓ͕͋͑ͣࣗ͏༻ͷϓϥάΠϯ Λ࡞Γ͍ͨͳΒ👍
• ͱʹ͔͘AndroidΤϯδχΞʹͱͬͯऔ͖͍ͬ͢ͷັྗ
ࢀߟ • IntelliJ Platform SDK (ެࣜυΩϡϝϯτ) • Android Studio Plugin
• JetBrains/compose-multiplatofrm ϦϙδτϦ (pluginͷαϯϓϧ) • JetBrains/android (Android Studio࣮) • pbreqult/adb-idea • AndroidͰϥΠτ/μʔΫϞʔυͷεΫγϣΛshellΛୟ͚ҰׅͰࡱӨͰ͖ΔΑ͏ʹͯ͠Έͨ | Qiita • Compose for DeskopͰ࢝ΊΔAndroid։ൃޮԽπʔϧͷ࡞ | Speaker Deck