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
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
4.8k
ソフトウェアラスタライザ
fadis
1
800
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
130
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
110
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
自分的「カンファレンスの楽しみ方」
syumai
0
200
Deep dive into the select statement (GopherCon UK)
jespino
0
170
【DroidKaigi 2026】「アクセシビリティを利用するとき、 アクセシビリティもまたこちらを利用している」 〜マルウェアによる攻撃と防衛について〜
halunoyo
0
430
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
120
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
180
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.9k
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
270
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
490
First, design no harm
axbom
PRO
2
1.3k
Navigating Team Friction
lara
192
16k
Utilizing Notion as your number one productivity tool
mfonobong
4
580
Unsuck your backbone
ammeep
672
58k
Thoughts on Productivity
jonyablonski
76
5.4k
BBQ
matthewcrist
89
10k
We Are The Robots
honzajavorek
0
350
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
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