Sample material transition animations for Android

Overview

See ListOfThings for a newer implementation.

Android Material Transitions

This Android project samples some Material Design-ish transitions for list items and floating action buttons. It uses the the shared element concept introduced in Android 5.0. I tried to pull it off with pure fragment transitions and ran into a few stags (see below) so my current solution uses an activity transition for each step.

[[MORE]]

Activity Transition tricks:

  • Generate a background bitmap immediately before the transition and pass it to the called activity
  • Suppress the view overaly (used by default for activity transitions) to keep shared elements behind the toolbar & system bars
  • Fall back to fade and scale activity transitions when < 5.0

Fragment Transition issues:

  • animating a shared element appears to only work when using .replace() - not .add()
  • Unlike Activity transitions, the view overlay is not used for fragment transitions so shared elements might animate behind other views (especially when reversing a transition). setElevation() helps some of the time.
  • if transitionName is set at runtime (with java - not xml) it may not survive all lifecycle events. E.g. when returning to a fragment from popBackStack()
  • On Activity transitions the second activity's elements are animated when the transition is played forward AND when reversed. For Fragment transitions, the second activity's elements are animated when played forward but the first activity's elements are animated when reversed.

More Help

License

Copyright 2015 Todd Way

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
PlayPauseDrawable 1.9 0.0 L5 Java This is a sample Play & Pause Drawable with morphing animation for Android
PlayPauseDrawable 1.9 0.0 L5 Java This is a sample Play & Pause Drawable with morphing animation for Android

#PlayPauseDrawable #Deprecated please go to https://github.com/tarek360/Material-Animation-Samples This is a sample Play & Pause Drawable with morphin

This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

How to apply meaningful and delightful motion in a sample Android app
How to apply meaningful and delightful motion in a sample Android app

Applying meaningful motion on Android How to apply meaningful and delightful motion in a sample Android app Read the complete post at https://medium.c

Android sample app following best practices: Kotlin, Compose, Coroutines and Flow, Hilt, JetPack Navigation, ViewModel, MVVM and MVI, Retrofit, Coil
Android sample app following best practices: Kotlin, Compose, Coroutines and Flow, Hilt, JetPack Navigation, ViewModel, MVVM and MVI, Retrofit, Coil

Foodies - Modern Android Architecture Foodies is a sample project that presents a modern 2021 approach to Android app development. The project tries t

A sample Android application with a strong focus on a clean architecture, automated unit and UI testing and continuous integration.

Android playground This is a sample Android application with a strong focus on a clean architecture, automated unit and UI testing and continuous inte

A sample Android app that demonstrates how to use Firebase Authentication, Crashlytics, Cloud Firestore and Hilt with Jetpack Compose UI

showcase.mp4 Make it So This is a sample Android app that demonstrates how to use Firebase Authentication, Crashlytics, Cloud Firestore and Hilt with

Sample to show how to implement blur graphical tricks
Sample to show how to implement blur graphical tricks

BlurEffectForAndroidDesign Sample to show how to implement blur graphical tricks All the explanations could be found here: http://nicolaspomepuy.fr/?p

[] Port of Jake Wharton's U2020 sample app with use of MVP and Dagger 2
[] Port of Jake Wharton's U2020 sample app with use of MVP and Dagger 2

U+2020-mvp [DEPRECATED] We recomend to try Moxy framework instead of our solution. Port of Jake Wharton's U2020 sample app with use of MVP pattern and

A simple sample showing the different types of notifications on Andoid

Notification example Simple notification. Expandable notification Progress notification Action button notification Notifications: MainActivity: Refs h

Comments
  • Clicking on half visible item

    Clicking on half visible item

    Clicking on a half visible item where the rest is hidden below the actionbar causes the element to jump in front of the actionbar before the transition begins.

    Is there a way to fix this?

    opened by leicht-io 0
  • java.lang.RuntimeException: Performing stop of activity that is not resumed

    java.lang.RuntimeException: Performing stop of activity that is not resumed

    Hi. Have you ever come across this exception when using activity/fragment transitions? It happens on Xperia Z3 compact running Android 5.1.1. I'm unable to produce it with your app, but I've used the TransitionHelper class to do achieve similar effects in my app and it's throwing this exception. The difference is my target activity has more complex layouts, but the exception sometimes happens even on first launch of the app right before starting the transition.

    Just thought you might have some insight. Thanks.

    opened by sebouh00 0
Owner
Todd Way
Todd Way
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
Collection of UIs and Animations built with Jetpack Compose for Android

Jet Composer is a sample app built with Jetpack Compose for Android, which demonstrates the various UIs and animations that can be built with it.

Prafull Mishra 378 Dec 17, 2022
A demo of the power menu with Reveal and other animations

MaterialPowerMenu A demo of the power menu with Reveal and other animations Some days ago, I saw a gif on Google+ demonstating a concept of Android Po

Naman Dwivedi 888 Oct 11, 2022
Quality-Tools-for-Android 7.5 0.0 L5 Java This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.

Quality Tools for Android This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android pl

Stéphane Nicolas 1.3k Dec 27, 2022
A sample Android app which showcases advanced usage of Dagger among other open source libraries.

U+2020 A sample Android app which showcases advanced usage of Dagger among other open source libraries. Watch the corresponding talk or view the slide

Jake Wharton 5.7k Dec 22, 2022
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Components Architecture in a Modular Word Android Components Architecture in a Modular Word is a sample project that presents modern, 2020 app

Madalin Valceleanu 2.3k Dec 30, 2022
Sample Project for Android Support Library 23.2

SnapShot: Contains features Vector Drawable Animated Vector Drawable AppCompat DayNight theme Bottom Sheets Using BottomSheetDialog in day-night mode.

Huqiu Liao 779 Nov 24, 2022
Sample application demonstrating Android design and animation

android-movies-demo This is a sample application showing off some interesting design/development interactions for a talk given at Droidcon 2013. As it

Daniel Lew 359 Jan 1, 2023
This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

Saul Molinero 165 Nov 10, 2022