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 Architecture Componentの Navigationで少しは...
Search
bigbackboom
July 23, 2019
Technology
0
580
Android Architecture Componentの Navigationで少しはまった話
bigbackboom
July 23, 2019
Tweet
Share
More Decks by bigbackboom
See All by bigbackboom
Androidエンジニアのお仕事でのショボーン
bigbackboom
0
31
解明!楽しいプレゼンする話すスキル
bigbackboom
0
25
Pay for Businessのgradle.ktsへの移行の小噺
bigbackboom
0
19
A Study in Bitmap: Is NDK the fast Processing method by CPU?
bigbackboom
0
180
Shallow Dip into Kotlin Coroutine
bigbackboom
0
120
RecyclerViewでViewPagerっぽいの作ろうとして頓死した話
bigbackboom
0
1.4k
Android開発でmitmproxyを使った話
bigbackboom
2
1.2k
Other Decks in Technology
See All in Technology
20240906_JAWS_Yamanashi_#1_leap_beyond_the_AWS_all_certifications
tsumita
1
100
Oracle Database 23ai 新機能 #3 Oracle Globally Distributed Database(GDD)
oracle4engineer
PRO
1
160
SHIFTの課題と目指したい組織像 / 20240827 Rinto Ikenoue
shift_evolve
0
140
HolidayJp.jl を作りました
mrkn
0
110
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
0
13k
ログラスが面白いと思う理由をマネージャーがエモく語ってみる / 20240829 vs LT
yoshikiiida
1
520
Envoy External AuthZとgRPC Extensionを利用した「頑張らない」Microservices認証認可基盤
andoshin11
0
140
Datadogの便利な使い方 - 意外と知らない?CoScreenとCloudcraft
taijihagino
PRO
1
600
[RSJ24] Object Segmentation from Open-Vocabulary Manipulation Instructions Based on Optimal Transport Polygon Matching with Foundation Models
keio_smilab
PRO
0
120
開発者体験を意識した開発チームの生産性向上の取り組み
ham0215
3
650
リクルート新人研修2024 テキスト生成AI活用
recruitengineers
PRO
10
420
APIのドキュメント化何使ってますか?
miu_crescent
2
160
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
Unsuck your backbone
ammeep
667
57k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
22
1.7k
RailsConf 2023
tenderlove
26
790
How to Think Like a Performance Engineer
csswizardry
15
910
Happy Clients
brianwarren
96
6.6k
For a Future-Friendly Web
brad_frost
173
9.3k
Optimising Largest Contentful Paint
csswizardry
28
2.7k
Writing Fast Ruby
sferik
623
60k
Creatively Recalculating Your Daily Design Routine
revolveconf
215
12k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
Transcript
Android Architecture Componentͷ NavigationͰগ͠·ͬͨ
ࣗݾհ — ٠/bigbackboom — CBcloudגࣜձࣾɹ
Navigationͱʁ — Google I/O 2018Ͱൃද͞ΕͨAndroid Architecture ComponentͷҰͭ — FragmentؒͷભҠΛϘτϜφϏͳͲͰߦ͏ͳͲෳࡶͳཁ݅ ͷͨΊʹ։ൃ͞Εͨɻ
— backstackͷཧ͕͍͠ — fragmentࣗମͷlifecycle͕ෳࡶ — ݟͨiOSͷstoryboardͳͲʹ͍͕ۙɺ༻ൣғ͍ͩ
ͳͥϘτϜφϏͰNavigationΛ͏ඞཁ͕͋Δʁ — Α͘ΘΕ͍ͯͨɺViewPager+BottomNavigationView ׂͱ࣮͕ෳࡶʢ࡞Δύʔπ͕ଟ͍ʣɻ — ViewPagerը໘ͷΩϟογϡॲཧ͕ಈ͘ͷͰɿ — ෳը໘͕ಉ࣌ʹಡΈࠐ·Εɺىಈ͕͘ͳΔ — ΩϟογϡʹΑͬͯɺը໘͕ഁغ͞Εબ࣌ʹҰ͔
ΒಡΈࠐ·ΕΔɻ
BottomNavigationView + NavigationΛ࣮ — ͜ͷrepositoryΛϕʔεʹΘ ͤͯΒ͍·ͨ͠ɻ — ߏӈͷը૾ͷΑ͏ʹͳ͍ͬͯ ·͢ɻ
λϒຖͷঢ়ଶҡ࣋ — Կ͠ͳ͍ͱɺ DashboardFragmentͱ NotificationsFragmentλϒ͕ બ͞ΕΔͨͼʹॳظԽ͞ΕΔ — ͦΕΛආ͚ΔͨΊʹɺ BottomNavigationViewͱ FragmentͷੜΛհ͢Δɺ
FragmentNavigatorΛࣗ࡞͢Δ ඞཁ͕͋Δɻ
— ࢀߟrepositoryͰ KeepStateNavigatorͱ͍͏ͷ Λ࡞͍ͬͯΔɻ — ·ͨɺBottomNavigationViewͱ FragmentͷؔΛఆٛͨ͠ɺ nav_graph.xmlͰ KeepStateNavigatorΛ༻ͯ͠ ͍Δ
ͰɾɾɾԿʹ·ͬͨͷʁ — Activity͔ΒFragmentʹΛ͢͜ͱ͕Ͱ͖ͳ͍ɾɾɾ — ௨ৗͰ͋Ε,ԼهͷΑ͏ʹ͢ΕΛϑϥάϝϯτʹͤ Δɻ val bundle = Bundle().apply
{ putString("NOTIFICATION_KEY", "bigbacbkboom is here") } NavController.navigate(item.itemId, bundle)
͕͔ͩ͠͠ɾɾɾ
null ͩͱɾɾɾ
దʹͨΓΛ͚ͭΔ
KeepStateNavigator෦ͰσόοΨͰࢭΊͯΈΔ — Έ͚ͬͽΐΜ
KeepStateNavigator.kt ίʔυΛमਖ਼ ҎԼͷߦΛҰͭՃ͢Δ͚ͩɻ var fragment = manager.findFragmentByTag(tag) fragment?.arguments = args
if (fragment == null) { val className = destination.className fragment = manager.fragmentFactory.instantiate(context.classLoader, className) transaction.add(containerId, fragment, tag) } else { transaction.attach(fragment) }
मਖ਼༰ʁ — fragmentΛੜ͢Δͱ͖ʹɺBundleΛͯ͋͛͠ΔॲཧΛ ॻ͚͍͍ͱ͍͏ࢸۃ୯७ͳͷͰ͢ɻ — ͨͩɺਓͷίʔυΛૉʹίϐʔͯͨ͠ͷͰɺΓ͜Ε ʹؾ͕ͭ͘ͷʹۤ࿑͠·ͨ͠ɻ
݁ — NavigationViewPage+BottomNavigationViewrΑΓ ύʔπ͕গͳָ͘ɻ — ͲΜͳ͜ͱಉ͡Ͱ͕͢ɺΓͲΜͳ͜ͱͪΌΜͱཧ ղ͠ͳ͍ͱ௧͍ΛݟΔɻ
We are Hiring! — Ұॹʹಇؒ͘Λ୳͍ͯ͠·͢ɻ — αʔϏεࢤͷํ — ੵۃతʹఏҊͯ͠৽͍ٕ͠ज़ͷΤϯδχΞϦϯάΛߦ͍ͨ ͍ํ
— ϚωʔδϝϯτΛ͍ͨ͠ํ https://www.wantedly.com/companies/cb-cloud