shared element transitions

15
Shared Element Transitions GDG Leeds - February 2017 Mike Scamell

Upload: mike-scamell

Post on 13-Apr-2017

12 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Shared Element Transitions

Shared Element TransitionsGDG Leeds - February 2017Mike Scamell

Page 2: Shared Element Transitions

What are Shared Element Transitions?

Page 3: Shared Element Transitions

Google Play Music

Page 4: Shared Element Transitions

Plaid

Page 5: Shared Element Transitions

eBay

Page 6: Shared Element Transitions

How do they work?

Page 7: Shared Element Transitions

Why should I use them?

Material motionFocal point

Hint

Distraction

Refined

Easy to implement

Can be used with image loading libs

They look cool 😎

Page 8: Shared Element Transitions

SHOW ME THE DAMN CODE! 😠

Page 9: Shared Element Transitions

Enabling

<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> //add this line to your file <item name="android:windowContentTransitions">true</item></style>

Page 10: Shared Element Transitions

Transition Names

<ImageView android:id="@+id/simple_activity_a_imageView" android:layout_width="128dp" android:layout_height="96dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="80dp" android:scaleType="centerCrop" android:src="@drawable/lion" android:transitionName="simple_activity_transition" />

Page 11: Shared Element Transitions

Setting the Shared Element Transition

Intent intent = new Intent(SimpleActivityA.this, SimpleActivityB.class);ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( SimpleActivityA.this, imageView, "simple_activity_transition");startActivity(intent, options.toBundle());

Page 13: Shared Element Transitions

Gotchas?

White flashingNav bar, Status bar

Picasso

May need to exclude other views

Large images

Page 14: Shared Element Transitions

Standing on the shoulders of giants

Articleshttps://medium.com/@bherbst/fragment-transitions-with-shared-elements-7c7d71d31cbb#.lry08ybje

http://www.androidauthority.com/using-shared-element-transitions-activities-fragments-631996/

https://guides.codepath.com/android/Shared-Element-Activity-Transition

https://developer.android.com/training/material/animations.html

Fixeshttps://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb

Sampleshttps://github.com/alexjlockwood/adp-activity-transitions

Page 15: Shared Element Transitions

Thank youhttps://github.com/mikescamell/shared-element-transitionshttp://mikescamell.com/shared-element-transitions-part-1

@mikescamell