Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
複雑なレイアウト組む時あるあるは コンポーネント化で解決しよう
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ぎーにょ
March 19, 2019
Technology
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
複雑なレイアウト組む時あるあるは コンポーネント化で解決しよう
ぎーにょ
March 19, 2019
More Decks by ぎーにょ
See All by ぎーにょ
AndroidにおけるNotificationのおさらい & Android16の新API Progress-centric Notifications
ginyolith
0
270
Google IO 2022 Jetpack Composeのパフォーマンス 社内LT会資料
ginyolith
0
1.4k
各OS1人ずつ開発の辛みあるあるは アーキテクチャで解決出来そう
ginyolith
2
450
クリぼっちでも出来る issue駆動開発
ginyolith
0
600
Other Decks in Technology
See All in Technology
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
180
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
32
28k
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
1
2.9k
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
210
Deployment の 先にある AI Agent 基盤 - kagent vNext、Agent Substrate、Hermes から読み解く Agent Runtime の現在地 / k8s-matsuri-2-ai-agent-platform-amsy810
masayaaoyama
4
670
Issue 駆動でスペシャリストの意図を届ける、AI 実装のアクセシビリティ向上
thkt
0
120
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
110
おい、エージェントを使って終わらせろ
nwiizo
2
720
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
140
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
410
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2.1k
安心して変更できるWebフロントエンドの作り方
pirosikick
5
2.8k
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
300
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
410
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
340
Skip the Path - Find Your Career Trail
mkilby
1
230
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
400
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Building Adaptive Systems
keathley
44
3.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Transcript
ෳࡶͳϨΠΞτΉ࣌͋Δ͋Δ ίϯϙʔωϯτԽͰղܾ͠Α͏ ͋Δ͋ΔLTʙεϚϗΞϓϦ։ൃΤϯδχΞʙ VOL.3 2019/03/19 @GINYOLITH_TECH
ςΩετ SELF INTRODUCTION data class Ginyolith( val realName : String
= “Fumiya Akagi", val nickName : String = "ぎーにょ", var belongingTo : String = "株式会社アイリッジ", var position : String = "Androidアプリ開発", val loves : List<String> = mutableListOf( "写真", "アカペラ(音楽)", "インドカレー", "仮面ライダー"), val twitterId : String = "@ginyolith_tech" ) : Human()
AGENDA ࠓ͓͢Δࣄ ▸ ෳࡶͳϨΠΞτΛΉ࣌͋Δ͋Δ ▸ Style/CustomView/include/Fragment ͷಛੑ ▸ Style/CustomView/include/Fragment ͷ͍͚
▸ ݱࡏͷ՝
ARUARU ෳࡶͳϨΠΞτΛΉ࣌͋Δ͋Δ ▸ ωετ͗ͯ͢͠ҙຯෆ໌ʹͳΔlayout.xml ▸ େྔͷViewΛίϯτϩʔϧ͢ΔɺActivity/Fragment/ViewModel ▸ widthheightɺbackgroundͷઃఆʹσδϟϰΛײ͡Δࣄ͕ଟൃ ▸ Α͘Θ͔Μͳ͍͚Ͳdatabinding͕ಈ͔ͳ͍ʢٽʣ
HOW TO COMMONIZE VIEWS VIEWͷڞ௨Խͷํ๏ FRAGMENT INCLUDE STYLE CUSTOM VIEW
ACTIVITY DIMEN.XML
HOW TO COMMONIZE VIEWS ࠓ͓͢Δࣄ FRAGMENT INCLUDE STYLE CUSTOM VIEW
ͦΕͧΕԿ͕ग़དྷΔͷʁ Ͳ͏͍͚Δͷʁ
HOW TO COMMONIZE VIEWS STYLE ▸ ʮView Οϯυͷ֎؍ॻࣜΛࢦఆ͢ΔϓϩύςΟͷू߹ʯ by Google
Developers ▸ ThemeʹԠͯ͡ಈతʹ৭Λఆٛ͢Δ͜ͱՄೳ ▸ ϩδοΫঢ়ଶΛ࣋ͭ͜ͱෆՄೳɻ͋͘·ͰݟͨͷΈ੍ޚ
HOW TO COMMONIZE VIEWS - STYLE - View Οϯυͷ֎؍ॻࣜΛࢦఆ͢ΔϓϩύςΟͷू߹ <View
android:layout_height=“match_parent" android:layout_width="1dp" android:layout_marginBottom=“10dp" android:layout_marginTop=“10dp” android:background=“@color/borderGray”/> <View style="@styleAppTheme.Border.Gray"/>
HOW TO COMMONIZE VIEWS - STYLE - View Οϯυͷ֎؍ॻࣜΛࢦఆ͢ΔϓϩύςΟͷू߹ <View
android:layout_height=“match_parent" android:layout_width="1dp" android:layout_marginBottom=“10dp" android:layout_marginTop=“10dp” android:background=“@color/borderGray”/> <View style="@style/ AppTheme.Border.Gray"/> <style name="AppTheme.Border"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">1dp</item> <item name="android:layout_marginBottom">10dp</item> <item name="android:layout_marginTop">10dp</item> </style> <style name="AppTheme.Border.Gray" parent="AppTheme.Border"> <item name="android:background">@color/borderGray</item> </style>
HOW TO COMMONIZE VIEWS INCLUDE ▸ layout.xmlͰ࡞ͨ͠ϨΠΞτΛ͍·Θ͢ ▸ ϩδοΫΛแ͠ͳ͍ ▸
ϩδοΫͱϨΠΞτΛͯ͠ɺϩδοΫ͚ͩڞ༗Խ͕Մೳ ▸ ϩδοΫͰContextΛऔಘ͢Δͷ͕͍͠
HOW TO COMMONIZE VIEWS - INCLUDE - ϩδοΫΛแ͠ͳ͍ class UserViewModel()
{ val searchTerm :String fun search() { repository .search(searchTerm) } } <?xml version="1.0" encoding="utf-8"?> <layout> <data> <variable name="viewModel" type=“hoge.UserViewModel”/> </data> <android.support.constraint.ConstraintLayout> <Button android:onClick="@{() -> viewModel.search()}"/> </android.support.constraint.ConstraintLayout> </layout> component_user_search.xml <include layout=“@layout/component_user_search” app:viewModel="@{userViewModel}"/> ϩδοΫͱঢ়ଶΛ ࣋ͭΠϯελϯεΛೖՄ ೳ
<?xml version="1.0" encoding="utf-8"?> <layout> <data> <variable name="viewModel" type=“hoge.UserViewModel”/> </data> <android.support.constraint.ConstraintLayout>
<Button android:onClick="@{() -> viewModel.search()}"/> </android.support.constraint.ConstraintLayout> </layout> HOW TO COMMONIZE VIEWS - INCLUDE - ϩδοΫͱϨΠΞτΛͯ͠ɺϩδοΫ͚ͩڞ༗Խ͕Մೳ component_user_search.xml <?xml version="1.0" encoding="utf-8"?> <layout> <data> <variable name="viewModel" type=“hoge.UserViewModel”/> </data> <android.support.constraint.ConstraintLayout> <TextView android:onClick="@{() -> viewModel.search()}"/> </android.support.constraint.ConstraintLayout> </layout> component_user_search_text.xml ΄΅ߏಉ͕ͩ͡ɺඍົʹݟ ͕ͨҟͳΔ ΄΅ߏಉ͕ͩ͡ɺ ඍົʹݟ͕ͨҟͳΔ
HOW TO COMMONIZE VIEWS - INCLUDE - ϩδοΫͱϨΠΞτΛͯ͠ɺϩδοΫ͚ͩڞ༗Խ͕Մೳ component_user_search.xml <include
layout="@layout/hoge" app:viewModel="@{userViewModel}"/> <include layout=“@layout/fuga" app:viewModel="@{userViewModel}"/> ΄΅ߏಉ͕ͩ͡ɺඍົʹݟ ͕ͨҟͳΔ ϩδοΫͷڞ௨ԽΛɺ ಛघͳॲཧΛॻ͔ͣʹߦ͏͜ͱ͕Մೳ component_user_search_text.xml
HOW TO COMMONIZE VIEWS CUSTOM VIEW ▸ ঢ়ଶͱϩδοΫΛแ ▸ contextΛ༻͍ͨϩδοΫΛ࣮ՄೳʢIntentͷൃߦͳͲʣ
▸ ಠࣗͷattributeΛఆٛग़དྷΔ ▸ طଘͷViewΛ֦ுͯ͠͏͜ͱՄೳ ▸ ViewGroupΛࣗ࡞͢ΔࣄՄೳ ੍͕গͳ͘ɺ෯͍ػೳͱҙຯΛͨͤΒΕΔ
HOW TO COMMONIZE VIEWS - CUSTOM VIEW - ঢ়ଶͱϩδοΫΛแ STYLE
VIEW INCLUDE VIEW VIEW VIEW LOGIC(INJECTED) CUSTOM VIEW VIEW VIEW VIEW LOGIC ATTRIBUTE LOGIC(INJECTED) UI
HOW TO COMMONIZE VIEWS - CUSTOM VIEW - ঢ়ଶͱϩδοΫΛแ CUSTOM
VIEW VIEW VIEW VIEW LOGIC ATTRIBUTE LOGIC(INJECTED) UI ViewͷΈ߹Θͤʢ୯ମViewՄʣ ViewͷݟͨɺଐੑɺStyle Viewݻ༗ͷଐੑΛఆٛՄೳ Viewʹݻ༗ϩδοΫΛΧϓηϧԽ OnClickListenerɺϩδοΫΛೖ
HOW TO COMMONIZE VIEWS FRAGMENT ▸ ಠࣗʹϥΠϑαΠΫϧΛ࣋ͭɻʢ།ҰϥΠϑαΠΫϧपΓͷॲཧΛΧϓηϧԽՄೳʣ ▸ Viewͱͷίϛϡχέʔγϣϯ͍͠ɻ ▸
ಛఆͷActivity/Fragement͔ΒͷΈݺͼग़ͤΔΑ͏ʹ͢Δରࡦ͕ඞཁ ▸ ϩδοΫΛೖग़དྷͳ͍ ▸ CustomViewStyleͱൺɺݟͨΛ͔Β੍ޚ͠ਏ͍ ಠཱੑ͕ߴ͍CUSTOMVIEW
Ͳ͏͍͚Ε͍͍ʁ ಛੑཧղͨ͠
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ ×
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × ݟͨͷڞ௨ԽʹಛԽ
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × ϩδοΫΛೖՄೳ
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × Ұ௨Γग़དྷΔ
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × VIEW͔Βͷ੍ޚ ʹ੍͓͍ͯ
·ͱΊ
SUMMURY ڞ௨Խର͕ɾɾɾ ෳͷVIEWͷ Έ߹Θͤ STYLE NO Yes ϩδοΫΛ แ Yes
VIEW͔Βݟ ͨΛ੍ޚ INCLUDE NO NO FRAGMENT CUSTOM VIEW Yes
SUMMARY ·ͱΊ ▸ AndroidͷViewͷڞ௨Խʹ৭ʑͳํ๏͕͋Δ ▸ ੍ҙຯ͚ʹԠ͍͚ͯ͡Δͱ… ▸ Ϧʔμϒϧͳίϯϙʔωϯτʹ ▸ ༨ͳ࣮ΛͤͣΑΓޮతʹViewΛ࡞Մೳ
PROBLEMS ՝ ▸ component_ͩͬͨΓview_ͩͬͨΓɺ໋໊نଇ ͕όϥόϥ ▸ atomic designͷߟ͑ํΛద༻ͯ͠componentͷ ཻΛཧग़དྷͳ͍͔ߟ͍͑ͯΔ
THANK YOU FOR LISTENING!!