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
MotionLayout : Animation Magic
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Thomas Kioko
October 05, 2018
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MotionLayout : Animation Magic
Thomas Kioko
October 05, 2018
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Chasing Engaging Ingredients in Design
codingconduct
0
220
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
160
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
sira's awesome portfolio website redesign presentation
elsirapls
0
280
Technical Leadership for Architectural Decision Making
baasie
3
420
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Tell your own story through comics
letsgokoyo
1
960
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
Done Done
chrislema
186
16k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
Transcript
MotionLayout @code_wizard https:/ /github/kioko https:/ /thomaskioko.com Thomas Kioko Android Engineer
Constraint Layout 2.0
BUT FIRST …
AbsoluteLayout FrameLayout RelativeLayout CoordinatedLayout … LinearLayout Take me Back
Other Layouts R.I.P
Constraint 1.1
Chains Circular Constraints Helpers Barries ConstraintLayout 1.1
ConstraintLayout 2.0
There’s more …
ConstraintLayout 2.0
Will I be able to control robots? 2.0… Why?
Will it take me to the moon? 2.0… Why?
“ “ “ “ MotionLayout
Bring your UI back from the dead Animations
ConstraintSet Constraint MotionScene Events Transition KeyFrames Key Concepts
Let’s Cook Some Code
Gradle Dependency dependencies{ … implementation 'androidx.constraintlayout:constraintlayout: 2.0.0-alpha2' }
- Improvments on Support Library - Backward compatibility. Btw …
AndroidX released with JetPack
The UI
A few minutes later…. …..
Movie UI -1- Define The Layouts
activity_movie_detail.xml <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/motion_layout_movie_detail” … > … </androidx.constraintlayout.widget.ConstraintLayout >
Let’s dance -2- Switch to MotionLayout
activity_movie_detail.xml <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/motion_layout_movie_detail” … > … </androidx.constraintlayout.motion.widget.MotionLayout>
xml/ scene_movie.xml <MotionScene … > </MotionScene> -3- Define TheScene
- Start: constraintSetStart - End: constraintSetEnd ConstraintSets 2 States Types
xml/ scene_movie.xml <MotionScene … > <ConstraintSet android:id=“@+id/start”> … </ConstraintSet> <ConstraintSet
android:id=“@+id/end”> … </ConstraintSet> </MotionScene> -4- Add ConstraintSet
xml/ scene_movie.xml <MotionScene … > <Transition app:constraintSetEnd="@id/end" app:constraintSetStart="@id/start”> </Transition> …..
</MotionScene> -5- Add Transition
Reusing Constraints .Have the same Id as the widgets. .
Rewrite Constraints Constraint
xml/ scene_movie.xml <MotionScene … > <Transition … </Transition> <Constraint app:constraintSetStart="@id/start”>
<Constraint android:id="@+id/iv_backdrop" android:layout_width="wrap_content" android:layout_height=“280dp” app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </Constraint> </MotionScene> -6- Add Constraint Start
xml/ scene_movie.xml <MotionScene … > <Transition … </Transition> <Constraint app:constraintSetStart="@id/end”>
<Constraint android:id="@+id/iv_backdrop" android:layout_width="wrap_content" android:layout_height=“30dp” app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </Constraint> </MotionScene> -7- Add Constraint End
xml/ scene_movie.xml -8- Add Other Constraints
.onClick The Trigger . onSwipe Transition Events
xml/scene_movie.xml <MotionScene … > <Tranision> <OnSwipe app:dragDirection="dragUp" app:touchAnchorId="@id/recycler_view_episodes" app:touchAnchorSide=“top” />
</Transition> </MotionScene> -9- Add Event
Prepare for Landing
Let’s up MotionScene & the Layout -10- Last Line (I
Think ..)
layout/movie_detail_activity.xml -11- Add Event <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/motion_layout_movie_detail” app:layoutDescription="@xml/scene_movie_detail” … > …
</androidx.constraintlayout.motion.widget.MotionLayout>
…
None
The End
CustomAttributes . Position KeyFrames . KeyTimeCycle . What Next? MotionLayout
Editor .
@code_wizard The End. https://github.com/kioko https://thomaskioko.com