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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
71
DnD in Compose
punchdrunker
0
360
what's new in Material Design で気になったトピック
punchdrunker
1
660
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
760
レビュー評価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
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
520
ActionController meets Protocol Buffers
sorah
0
530
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
ジョジョの世界をXRで再現する
mofurune
0
160
すこし踏み込む CancellationToken
htkym
2
1.7k
Jetpack Compose Mechanisms
skydoves
3
820
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Workers Cache を知る
syumai
0
370
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Scaling GitHub
holman
464
140k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
A better future with KSS
kneath
240
18k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
We Have a Design System, Now What?
morganepeng
55
8.4k
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