Set of extra Transitions on top of Jetpack Transitions Library

Overview

Transitions Everywhere

Set of extra Transitions on top of AndroidX Transitions Library.

About

Article about transitions and library
Originally this library was a full backport of Android Platform's Transitions API.
Then all the bug fixes from the library were ported into AndroidX Transitions (previously Support library).
Now this lib has minSdk version 14 (Android 4.0 ICS) and consist of some transitions which are not a part of the official set:

  1. Internal Transitions that was marked as @hide in the platform: Recolor, Rotate, ChangeText and Crossfade.
  2. Two extra transitions: Scale and Translation.

Quick start

This version should be used if you are specifying 29 (Q) as a targetSdkVersion:

dependencies {
    implementation "com.andkulikov:transitionseverywhere:2.1.0"
}

Otherwise, if you specify 29 as targetSdkVersion some of the transitions will not work properly. Instead of the reflection calls this version uses the new public methods added in API Level 29. It is based on androidx.transition:transition:1.2.0.

Previous version if you are not yet on 29 (Q) SDK:

dependencies {
    implementation "com.andkulikov:transitionseverywhere:2.0.0"
}

This version is based on androidx.transition:transition:1.1.0.

Migration from 1.x guide

  1. Migrate to AndroidX! Support libraries are not updating anymore, to get all the bug fixes you have to use AndroidX transitions.
  2. Replace imports from com.transitionseverywhere. to androidx.transition. for all the classes which are a part of the AndroidX lib.
  3. If you were using Transition.TransitionListenerAdapter class use TransitionListenerAdapter now.
  4. Instead of TransitionManager.setTransitionName() use ViewCompat.setTransitionName().
  5. If you were inflating transitions via xml move your files from anim folder to transition and use android: namespace instead of app:
  6. Some setters in AndroidX transitions are not following the builder pattern, please rewrite this usages with introducing a helper variable if you encounter the issue.
  7. Instead of TranslationTransition use Translation.

Articles about the version 1.x

Article about transitions and library
Russian version
Chinese: version 1, version 2

Changelog for version 1.x

Comments
  • Alpha values not being respected in scenes

    Alpha values not being respected in scenes

    Hello thanks for this backport! I have however found an issue where it isn't not playing nicely with another widget library.

    I have a sample project here demonstrating the issue. If you compile and run the project and click the add payment method button the Transition will kick in displaying a new scene. If android:ids are shared between scenes then it looks as if the alpha values are not honored. Switching the Transition package names back to the framework will resolve the issue.

    Here is the sample project https://drive.google.com/file/d/0B9BQRk_YVoNrdDVqVVduY3dnY0k/view?usp=sharing

    And here is a link to the issue originally opened on the widget library. https://github.com/IanGClifton/AndroidFloatLabel/issues/20

    opened by nschwermann 10
  • Customizing changeBounds animation in xml ignores attributes(?)

    Customizing changeBounds animation in xml ignores attributes(?)

    I have the following transition specified in xml:

    <?xml version="1.0" encoding="utf-8"?>
    <changeBounds xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="4000"/>
    

    When I use this in the following manner:

    Scene temp = current;
    current = other;
    other = temp;
    Transition myTransition = TransitionInflater.from(this).inflateTransition(R.anim.move);
    TransitionManager.go(current, myTransition);
    

    The transition partially works, though the duration isn't taken into account at all. Adding an interpolator also does nothing. In the logs I see the following:

    11-11 19:50:15.184    4983-4983/com.example.gregloesch.playground I/dalvikvm﹕ Could not find method android.animation.PropertyValuesHolder.ofObject, referenced from method android.transitions.everywhere.ChangeBounds.createAnimator
    11-11 19:50:15.184    4983-4983/com.example.gregloesch.playground W/dalvikvm﹕ VFY: unable to resolve static method 40: Landroid/animation/PropertyValuesHolder;.ofObject (Landroid/util/Property;Landroid/animation/TypeConverter;Landroid/graphics/Path;)Landroid/animation/PropertyValuesHolder;
    11-11 19:50:15.184    4983-4983/com.example.gregloesch.playground D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0314
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground I/dalvikvm﹕ Could not find method android.animation.ObjectAnimator.ofFloat, referenced from method android.transitions.everywhere.utils.AnimatorUtils.ofFloat
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground W/dalvikvm﹕ VFY: unable to resolve static method 28: Landroid/animation/ObjectAnimator;.ofFloat (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Landroid/graphics/Path;)Landroid/animation/ObjectAnimator;
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x001b
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground I/dalvikvm﹕ Could not find method android.animation.ObjectAnimator.ofInt, referenced from method android.transitions.everywhere.utils.AnimatorUtils.ofInt
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground W/dalvikvm﹕ VFY: unable to resolve static method 30: Landroid/animation/ObjectAnimator;.ofInt (Ljava/lang/Object;Landroid/util/Property;Landroid/util/Property;Landroid/graphics/Path;)Landroid/animation/ObjectAnimator;
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x001a
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground I/dalvikvm﹕ Could not find method android.animation.ObjectAnimator.ofInt, referenced from method android.transitions.everywhere.utils.AnimatorUtils.ofInt
    11-11 19:50:15.192    4983-4983/com.example.gregloesch.playground W/dalvikvm﹕ VFY: unable to resolve static method 32: Landroid/animation/ObjectAnimator;.ofInt (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Landroid/graphics/Path;)Landroid/animation/ObjectAnimator;
    
    opened by loeschg 9
  • a flickering when changing state of button.

    a flickering when changing state of button.

    When doing a simple sequential fade-in & fade out for two buttons for a moment text changes to something weird. i have tried support library too same result. ezgif com-video-to-gif

    opened by ghost 8
  • Fragment transitions?

    Fragment transitions?

    Hello,

    First of all, this is an excellent library and works quite well for scene transitions.

    I'm trying to apply it to fragments as enter transitions and I'm not able to use Explode() or ChangeBounds (or any transition) because of the following exception:

    Any ideas please? If it doesn't support fragment transitions, do you plan on supporting it someday?

    java.lang.ClassCastException: android.transitions.everywhere.ChangeBounds cannot be cast to android.transition.Transition at android.support.v4.app.FragmentTransitionCompat21.cloneTransition(FragmentTransitionCompat21.java:41) at android.support.v4.app.BackStackRecord.getEnterTransition(BackStackRecord.java:1056) at android.support.v4.app.BackStackRecord.configureTransitions(BackStackRecord.java:1138) at android.support.v4.app.BackStackRecord.beginTransition(BackStackRecord.java:1038) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:660) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

    enhancement 
    opened by qaiserhabib 8
  • Google has backported the Transitions framework to API14

    Google has backported the Transitions framework to API14

    https://developer.android.com/topic/libraries/support-library/revisions.html

    https://developer.android.com/reference/android/support/transition/package-summary.html

    opened by ivanfeli 7
  • ChangeText changes alpha to 1

    ChangeText changes alpha to 1

    After the transition the alpha has changed from previously 56% to 100%. The ChangeText Transition should keep track of the text style and set the style values to the previous values.

    I'm using this code to animate a text change.

    TransitionManager.beginDelayedTransition(container, ChangeText().setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN))
    
    opened by passsy 6
  • Can I edit transition animation..?

    Can I edit transition animation..?

    I know I should report some error kinda thing, but you're work is too awesome to make some issues for me.

    I really appreciate for your work.

    My question is, can I change animation settings like alpha value..? I'm using very basic one "automatic-" and I don't want that alpha setting...

    Thanks in advance ::D

    opened by BROUDING 6
  • Why JellyBeanMR2ViewGroupUtils use sceneRoot.getOverlay()?

    Why JellyBeanMR2ViewGroupUtils use sceneRoot.getOverlay()?

    In ViewOverlayPreJeelybean, we find frame layout with id 'android.R.id.content' and then add the same size framelayout to add overlayView, when use Visibility Transition, the overlayView animation can be drawn out of the sceneRoot's bounds. But in JellyBeanMR2ViewGroupUtils we use sceneRoot.getOverlay(), the overlay bound is the same as sceneRoot's , thus Visibility Transition can not be drawn out of the sceneRoot's bound. I have to download the source code and change sceneRoot.getOverlay() to the top parent framelayout's overlay to achieve my PM's requirement. Any ideas ? Thanks.

    opened by futurexiong 6
  • Fade transition displays its target views above targets of other transitions.

    Fade transition displays its target views above targets of other transitions.

    Hi,

    When I try to run a fade transition, and the equavalent of a 'move' transition in the same set, the fading elements always appear above the elements that move. Transition order or target view z order doesn't seem to matter at all. I've observed this behavior in both api v16 and v23.

    Is there any way to enforce some kind of z-ordering for views of these transitions?

    opened by urandom 6
  • [BUG] android 4.1.2

    [BUG] android 4.1.2

    This bug occurs in android 4.1.2 only(haven't checked for lower versions). Works fine with 4.3 and above. I provide as root view (ViewGroup) getActivity().getWindow().getDecorView().getRootView() . Seems that the casting is the reason of crashing

     java.lang.ClassCastException: android.view.ViewRootImpl cannot be cast to android.view.View            at android.transitions.everywhere.utils.ViewOverlayPreJellybean.getOverlay(ViewOverlayPreJellybean.java:123)    at android.transitions.everywhere.utils.ViewGroupOverlayUtils$BaseViewGroupOverlayUtilsImpl.initializeOverlay(ViewGroupOverlayUtils.java:53)       at android.transitions.everywhere.utils.ViewGroupOverlayUtils.initializeOverlay(ViewGroupOverlayUtils.java:156)            at android.transitions.everywhere.TransitionManager.sceneChangeRunTransition(TransitionManager.java:223)            at 
    android.transitions.everywhere.TransitionManager.beginDelayedTransition(TransitionManager.java:379)
                at    android.transitions.everywhere.TransitionManager.beginDelayedTransition(TransitionManager.java:340)
                at com.example.project.views.TutorialTip.animateChanges(TutorialTip.java:97)
                at com.example.project.views.TutorialTip.showOverlay(TutorialTip.java:81)
                at com.example.project.views.TutorialTip.show(TutorialTip.java:130)
                at com.example.project.tooltips.ProfileTooltipsHelper.showTooltip(ProfileTooltipsHelper.java:151)
                at com.example.project.tooltips.ProfileTooltipsHelper.showNext(ProfileTooltipsHelper.java:130)
                at com.example.project.screens.profile.FragmentProfileMe.showTips(FragmentProfileMe.java:97)
                at     com.example.project.screens.profile.FragmentProfileMe_.access$501(FragmentProfileMe_.java:26)
                at com.example.project.screens.profile.FragmentProfileMe_$2.run(FragmentProfileMe_.java:140)
                at android.os.Handler.handleCallback(Handler.java:615)
                at android.os.Handler.dispatchMessage(Handler.java:92)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4745)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                at dalvik.system.NativeStart.main(Native Method)
    
    opened by ArthurSav 6
  • Targets of a Transition is not removed while using removeTarget (int targetId)

    Targets of a Transition is not removed while using removeTarget (int targetId)

    Consider the following code:

     Transition transition = ...;
    
     transition.addTarget(R.id.my_view);
    
     ...
    
     transition.removeTarget(R.id.my_view);
    

    It is apparent from the documentation that the call to Transition.removeTarget(int) should remove the view with id R.id.my_view being included in further transitions. But instead the following error will be shown:

     Caused by: java.lang.IndexOutOfBoundsException: Invalid index <some-random-int>, size is 1
            at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
            at java.util.ArrayList.remove(ArrayList.java:403)
    

    this is because the implementation is calling ArrayList.remove(int) instead of ArrayList.remove(Object).

    PS: the upstream bug is at http://b.android.com/167061 or here

    opened by Avinash-Bhat 6
  • without button click

    without button click

    Hi All, can we do slide animation without on button click? i want when the activity start then text animate in slide animation starts, without any button click. Please help.

    opened by dharmeshrathore 2
  • Custom transitions

    Custom transitions

    Привет! На одном из моих проектов мне надо было анимировать смену TextView::textSize и я написал вот такой Transition. Может еще кому-то понадобится и поэтому решил создать pull request с ним (Он был написан на котлине. Но для ПР я его переписал на java)

    import android.animation.Animator
    import android.animation.ValueAnimator
    import android.content.Context
    import android.util.AttributeSet
    import android.util.TypedValue
    import android.view.ViewGroup
    import android.widget.TextView
    import androidx.transition.Transition
    import androidx.transition.TransitionValues
    
    class ChangeTextSize : Transition {
    
        constructor() : super()
        constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
    
        override fun captureStartValues(transitionValues: TransitionValues) {
            captureValues(transitionValues)
        }
    
        override fun captureEndValues(transitionValues: TransitionValues) {
            captureValues(transitionValues)
        }
    
        private fun captureValues(transitionValues: TransitionValues) {
            if (transitionValues.view is TextView) {
                transitionValues.values[PROP_NAME] = (transitionValues.view as TextView).textSize
            }
        }
    
        override fun createAnimator(sceneRoot: ViewGroup, startValues: TransitionValues?, endValues: TransitionValues?): Animator? {
            if (startValues == null || endValues == null || startValues.view !is TextView || endValues.view !is TextView)
                return null
    
            val start = startValues.values[PROP_NAME] as? Float ?: return null
            val end = endValues.values[PROP_NAME] as? Float ?: return null
            if (start == end) return null
    
            val view = endValues.view as TextView
    
            return ValueAnimator.ofFloat(start, end)
                    .apply { addUpdateListener { view.setTextSize(TypedValue.COMPLEX_UNIT_PX, it.animatedValue as Float) } }
        }
    
        companion object {
            private const val PROP_NAME = "ChangeTextSize.textSize"
        }
    }
    

    Неплохая идея собрать библиотеку с разными кастомными Transition! Жду Вашего фид-бэка!

    opened by GVFiQst 3
  • Alpha version Activity transition

    Alpha version Activity transition

    Доброго времени суток. Я попробовал сделать реализацию Transition между Activity на основе вашей библиотеки. Это в принципе более-менее рабочая версия. Просто хотелось бы услышать ваше мнение о такой реализации. Суть в том, что мы указываем view содержащий элементы которые нужно анимировать (если не указать берется content). У этой view мы получаем все элементы имеющие id, берем у них параметры нужные для анимации и засовываем все это в Intent. Запускаем новое Activity. На новом Activity на основе пришедших данных формируется FrameLayout. В setContentView мы вставляем этот FrameLayout, создаем сцену для Layout который по идее должен располагаться на этом Activity и вызываем ChangeScene для нее. С обратным Transition все немного сложнее. При вызове onBackPressed опять создаем FrameLayout на основе пришедших данных, затем находим все элементы из этих данных на текущем экране, берем важные для данного типа view данные (к примеру для ImageView это drawable) и вставляем в наши элементы на FrameLayout. На основе этого FrameLayout формируем сцену и вызываем changeScene.

    Еще нужно добавить какой-либо listener по завершению Transition, потому что сейчас завершение Activity делается с помощью postDelayed c отсрочкой равной длительности анимации, это кривой подход и бывает Activity завершается раньше, чем закончилась анимация.

    opened by princeparadoxes 8
Releases(v1.8.0)
Owner
Andrey Kulikov
Android Engineer at Google
Andrey Kulikov
RX-based async paradigm, Room, DI (Hilt), Retrofit, MVVM, Jetpack, Lottie, Transitions

CatBreedsApp RxJava, Room, DI (Hilt), Jetpack, Shared element transition. clean MVVM architecture, Retrofit Cats need your help, we want to build an a

Cristian Dumitrache 3 Oct 14, 2022
A backport of the new Transitions API for Android

TransitionsBackport Android library for using the Transitions API released with Android KitKat on older versions of Android. At the moment, it is comp

Stéphane Guérin 578 Dec 29, 2022
An android project presenting some transitions you can use between activities

ActivityTransition An android project presenting some transitions you can use between activities #Integration Add the anim folder to your Android proj

null 260 Nov 29, 2022
Navigation pattern like in Google News Stand app with transitions

Google-NewsStand-Animation-Android Navigation pattern like in Google News Stand app with transitions Getting Started In your build.gradle dependencies

Hariprasanth S 129 Nov 11, 2022
🍭🚀💗 Tutorials about animations with Animators, Animated Vector Drawables, Shared Transitions, and more

?????? Tutorials about animations with Animators, Animated Vector Drawables, Shared Transitions, and more

Smart Tool Factory 696 Dec 28, 2022
You can easily access the top of the screen in Android. Like a iPhone 6 & 6 Plus.

Reachability on Android Easy access on top. Like a iPhone 6 & 6 Plus. demo apk Usage Add dependencies compile 'com.github.sakebook:Reachability:0.2.0@

sakebook 258 Nov 12, 2022
FragmentTransactionExtended is a library which provide us a set of custom animations between fragments.

FragmentTransactionExtended FragmentTransactionExtended is a library which provide us a set of custom animations between fragments. FragmentTransactio

Antonio Corrales 1.1k Dec 29, 2022
Chandrasekar Kuppusamy 799 Nov 14, 2022
DuGuang 1k Dec 14, 2022
Introduction your app to the user , Easy to use and set Items as you want

Introduction App This lib helps to introduce the App-by view page based on Kotlin. Features Easy Set up Items: Title, Describe, Background, Buttons Ap

S.M.Zendehbad 0 May 6, 2022
Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animations painless.

AnimatableCompose Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animation painless. What you can create from M

Emir Demirli 12 Jan 2, 2023
🪐 Jetpack Compose animation library that allows you to implement animations such as shared element transition.

Orbitary ?? Jetpack Compose animation library that allows you to implement animations such as shared element transition. Download Gradle Add the depen

Jaewoong Eum 503 Dec 30, 2022
🪐 Jetpack Compose animation library that allows you to implement animations such as shared element transition.

?? Jetpack Compose animation library that allows you to implement animations such as shared element transition.

Jaewoong Eum 504 Jan 2, 2023
Group of libraries to help you build better animations with Jetpack Compose

Group of libraries to help you build better animations with Jetpack Compose

null 36 May 12, 2022
Compose-actors - Android app built with jetpack compose follows new revamped guide to app architecture

Compose Actors ?? Inspired from JetCaster JetNews JetSnack More compose content

Raj 110 Dec 29, 2022
DrawBox: a multi-purpose tool to draw anything on canvas, written completely on jetpack compose

DrawBox DrawBox is a multi-purpose tool to draw anything on canvas, written comp

Akshay Sharma 172 Dec 30, 2022
Examples of the use of animations in jetpack compose and view, as well as measurements of perfomance

AndroidAnimationWorld Примеры использования анимаций в jetpack compose и view, а также замеры perfomance для

Lukian Zhukov 7 Oct 22, 2022
PassCode is the Android app made by using Jetpack Compose. Created for the test task submission.

PassCode PassCode is the Android app made by using the Jetpack Compose. Created for the test task submission. Showcase Dark Theme Light Theme ACs The

Basil Miller 1 May 25, 2022
Jetpack Compose Animations

Jetpack Compose Animations Animations Duolingo Owl - Anmol Verma Screen.

Anmol Verma 218 Dec 29, 2022