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
Practical Activity Transition in Android
Search
punchdrunker
March 08, 2019
Programming
1.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Practical Activity Transition in Android
punchdrunker
March 08, 2019
More Decks by punchdrunker
See All by punchdrunker
Kotlin2.0以降の新機能
punchdrunker
0
64
DnD in Compose
punchdrunker
0
350
what's new in Material Design で気になったトピック
punchdrunker
1
650
7カ国語に対応したサービスでの翻訳管理システムの改善事例
punchdrunker
1
1.7k
Java Bytecode Vertical Tasting
punchdrunker
2
1.6k
getting started with dark theme
punchdrunker
2
1.1k
今時のProgress indicator / Replacing ProgressDialog with ProgressBar
punchdrunker
0
750
レビュー評価4.7の秘密 / The Secret To A Better Reputation
punchdrunker
2
2.1k
Dynamic Feature Modules 入門
punchdrunker
2
2.8k
Other Decks in Programming
See All in Programming
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
130
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
490
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
120
AIの中の人になってみる
htkym
0
170
不幸な GC
chencmd
0
900
高専キャリア LT 発表内容
crysta1221
6
5.6k
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
5.7k
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
200
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
170
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
How to make the Groovebox
asonas
2
2.4k
The Curious Case for Waylosing
cassininazir
1
500
The Spectacular Lies of Maps
axbom
PRO
1
990
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
How to build a perfect <img>
jonoalderson
1
6k
Building Adaptive Systems
keathley
44
3.2k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Thoughts on Productivity
jonyablonski
76
5.4k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
730
Transcript
Practical Transition by punchdrunker
ࣗݾհ —2010ʙ iOS/AndroidͷΞϓϦΛॻ͍ͯΈΔ —2011ʙ SNS mixi(ϛΫγΟ) —2016ʙ ՈΞϧόϜ ΈͯͶ(ϛΫγΟ) —DroidKaigiͱ͔shibuya.apkΛӡӦ
Sample code —https://github.com/punchdrunker/hocho —android-transition-examples —https://github.com/google/android-transition- examples
࣍ —SharedElementΛ͏·ͰͷܦҢ —༻ޠղઆ —͓खຊ —جຊతͳ͍͔ͨ —࣮ࡍͷΞϓϦͷద༻ —ͷղܾ๏ͱఘΊͨࣄ —·ͱΊ
ܦҢ ࣸਅҰཡը໘͔Βࣸਅͷৄࡉը໘ʹભҠͨ࣌͠ʹ... —Fling to finish(্ԼεϫΠϓͰด͡Δ)Λ࣮͍ͨ͠ —Ͳ͏ͤͳΒਮͳΞχϝʔγϣϯԋग़ग़དྷΔͱخ͍͠ —υΩϡϝϯτ௨Γʹॻ͍ͯΔͷʹಈ͔Μ!!!!1 —ॻ͍ͨ௨Γʹಈ͍ͯ·ͨ͠(ল) x 100
—શʹཧղͨ͠!! —࠳ં
༻ޠͷઆ໌(1) —Transition framework(ભҠ) —ը໘ભҠͰϨΠΞτʹΞχϝʔγϣϯޮՌΛ͚ Δ͜ͱͰ͖ΔϑϨʔϜϫʔΫͷ૯শ —minSdkVersion 21 —Transition —Transition ManagerʹΑͬͯཧ͞ΕΔɺ"ભ
Ҡ"ͦͷͷ
༻ޠͷઆ໌(2) —SharedElement(View) —ભҠݩͱભҠઌͰܨ͗߹Θ͍ͤͨViewɻoptionͱ ͯ͠startActivityʹ͢ɻ —Transition name(String) —ભҠݩͱભҠઌͷViewʹಉ͡transitionNameΛ ͚ΔࣄͰSharedElementͱͯ͠ೝࣝ͞ΕΔ
͓खຊʹͨ͠ͷ —android-transition-examples —https://github.com/google/android-transition- examples —twitterެࣜΫϥΠΞϯτ
جຊతͳ͍ํ
Transitionͷύλʔϯ —Fragment to Fragment —Activity to Activity
Fragment to Fragment 1ͭͷActivityͰͷભҠgoogle example͕ྫɻ ભҠ͢Δ࣌ͷFragmentManagerʹaddSharedElement ϝιουͰભҠݩͷImageViewͱtransitionNameΛϖ ΞͰηοτ͢Δɻ ભҠઌͰಉ༷ɻ (transitionNameͷઃఆίʔυଆ͔ΒͰϨΠΞτ
xml͔ΒͰՄೳɻ)
Fragment to Fragment ࣮ྫ ImageView transitioningView = view.findViewById(R.id.card_image); fragment.getFragmentManager() .beginTransaction()
.setReorderingAllowed(true) // Optimize for shared element transition .addSharedElement( transitioningView, transitioningView.getTransitionName()) .replace( R.id.fragment_container, new ImagePagerFragment(), ImagePagerFragment.class.getSimpleName()) .addToBackStack(null) .commit();
sampleͷಈ͖
Activity to Activity transitionNameΛϖΞͰઃఆ͢Δͷಉ͡ɻ startActivityͷoptionͱͯ͠ɺsharedElementΛϖΞʹ ͨ͠bundleΛ͢ɻ ෳ͚ͨ͠ΕPairܕͰՄมҾͱͯͤ͠Δɻ val intent =
ToActivity.createIntent(context, position) val option = ActivityOptions.makeSceneTransitionAnimation( activity, view, getString(R.string.shared_element)).toBundle() startActivity(intent, option)
࣮ࡍͷΞϓϦͷద༻ ͱͱͷ༷ —RecyclerViewͰࣸਅΛάϦουදࣔ —ભҠͨ͠ઌͷৄࡉը໘ͰࠨӈʹεϫΠϓ͢Δͱࣸਅ ΛҠಈͰ͖Δ(ViewPager) —εϫΠϓͨ͠ޙʹը໘Λดͯ͡ϦετʹΔͱɺͦͷ ҐஔʹεΫϩʔϧ͍ͯ͠Δ
ͱͦͷղܾ๏ ͔͜͜ΒαϯϓϧΛݟͳ͕Βղઆ͠·͢(item1&2&3)
AppBar/ϑολ͔ͿΔ ্ԼʹॏͳΔView͕͋ͬͨΒεΫϩʔϧͰճආ private fun shoulScrollList(cell: View): Boolean { val cellLocation
= IntArray(2) cell.getLocationOnScreen(cellLocation) val cellTop = cellLocation[1] val listLocation = IntArray(2) binding.list.getLocationOnScreen(listLocation) val diffToAppBar = cellTop - listLocation[1] val cellBottom = cellTop + binding.list.height val listBottom = listLocation[1] + binding.list.height val diffToBottom = cellBottom - listBottom return (diffToAppBar < 0 || diffToBottom > 0) }
ViewPagerͰࠔΔ͜ͱ —item4Ͱ͕ൃੜ͢Δ —ճආࡦΛitem5ͰରԠ
εϫΠϓͨ͠ޙʹΓઌͷImageViewΛมߋ͢Δʹ ίʔϧόοΫͰಈతʹมߋͰ͖Δ
ViewPagerͱͷ࿈ܞ ඞਢίʔϧόοΫ —setEnterSharedElementCallback —setExitSharedElementCallback FragmentManagerΛͬͨભҠͰɺFragmentͰར ༻ startActivityΛͬͨભҠͰɺActivityͰར༻
ίʔϧόοΫͰԿ͕ग़དྷΔ͔ ඥ͘SharedElementΛಈతʹมߋͰ͖Δ setExitSharedElementCallback(object : SharedElementCallback() { // names: List<String>, sharedElements:
MutableMap<String, View> override fun onMapSharedElements(names: ..., sharedElements: ...) { val viewHolder = fromFragment?.getViewHolder(newPosition) val itemView = viewHolder?.itemView ?: return val photoView = itemView.findViewById<ImageView>(R.id.card_photo) sharedElements[names[0]] = photoView } })
ίʔϧόοΫͷλΠϛϯά —Activity A(Ұཡ)͔ΒActivity B(ৄࡉ)ʹભҠ —AͷExitSharedElementCallback͕ݺΕΔ —BͷEnterSharedElementCallback͕ݺΕΔ —B͔ΒAʹΔ —BͷEnterSharedElementCallback͕ݺΕΔ —AͷExitSharedElementCallback͕ݺΕΔ
ͳͥ? Δ࣌ͷActivity Transitionདྷͨ࣌ͷanimationΛ reverse͢Δҝ (finishAfterTransition ͋ͨΓΛಡΉͱॻ͍ͯ͋Δ)
͞ΒʹεΫϩʔϧ͕ඞཁ ఘΊͨ
None
͞ΒͳΔ Transition Animation ͕X?????a ܥͷͰ·ͱʹ ಈ͔ͳ͔ͬͨ !
ղࢄ
FIN