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

Overview

FragmentTransactionExtended

Logo Logo

FragmentTransactionExtended is a library which provide us a set of custom animations between fragments. FragmentTransaction only accepts some simple animations (TRANSIT_FRAGMENT_CLOSE, TRANSIT_FRAGMENT_FADE, TRANSIT_FRAGMENT_OPEN...).

List of animations added:

  • SCALEX
  • SCALEY
  • SCALEXY
  • FADE
  • FLIP_HORIZONTAL
  • FLIP_VERTICAL
  • SLIDE_VERTICAL
  • SLIDE_HORIZONTAL
  • SLIDE_HORIZONTAL_PUSH_TOP
  • SLIDE_VERTICAL_PUSH_LEFT
  • GLIDE
  • SLIDING
  • STACK
  • CUBE
  • ROTATE_DOWN
  • ROTATE_UP
  • ACCORDION
  • TABLE_HORIZONTAL
  • TABLE_VERTICAL
  • ZOOM_FROM_LEFT_CORNER
  • ZOOM_FROM_RIGHT_CORNER
  • ZOOM_SLIDE_HORIZONTAL
  • ZOOM_SLIDE_VERTICAL

Because FragmentTransaction.setCustomAnimations needs to use ObjectAnimator in XML and the animations of this library needs some fractional values is necesary to extends the fragment container from SlidingRelativeLayout, this class contains the necessary getters and setters.

<com.desarrollodroide.libraryfragmenttransitionextended.SlidingRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
</com.desarrollodroide.libraryfragmenttransitionextended.SlidingRelativeLayout>

The container of the fragments must extends from SlidingRelativeLayout like the example

<com.desarrollodroide.libraryfragmenttransactionextended.SlidingRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/back1" >
    <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
</com.desarrollodroide.libraryfragmenttransactionextended.SlidingRelativeLayout>

You need to declare in your activity manifest if you need to manage change orientations:

android:configChanges="keyboardHidden|orientation|screenSize"

Usage FragmentTransitionExtended

Constructor:

FragmentTransactionExtended fragmentTransactionExtended = new FragmentTransactionExtended(context, fragmentTransaction, firstFragment, secondFragment, containerID);

AddTransition:

fragmentTransactionExtended.addTransition(FragmentTransactionExtended.*);

Example:

FragmentManager fm = getFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
FragmentTransactionExtended fragmentTransactionExtended = new FragmentTransactionExtended(this, fragmentTransaction, firstFragment, secondFragment, R.id.fragment_place);
fragmentTransactionExtended.addTransition(FragmentTransactionExtended.GLIDE);
fragmentTransactionExtended.commit();

Gradle

dependencies {
    compile 'com.desarrollodroide:fragmenttransactionextended:1'
}

Special Thanks

Developed By

Antonio Corrales [email protected]

License

Copyright 2014 Antonio Corrales

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.
Comments
  • SLIDING animation not working when backStack is not equal to 0 !!

    SLIDING animation not working when backStack is not equal to 0 !!

    Hi, Sliding animation isn't working when you have opened more then one fragment.

    i get following errors : Thanks for making the great library which saves allot of time :+1:

    08-18 05:35:42.416: E/AndroidRuntime(23429): FATAL EXCEPTION: main 08-18 05:35:42.416: E/AndroidRuntime(23429): java.lang.NullPointerException 08-18 05:35:42.416: E/AndroidRuntime(23429): at com.desarrollodroide.libraryfragmenttransactionextended.FragmentTransactionExtended.slideBack(FragmentTransactionExtended.java:248) 08-18 05:35:42.416: E/AndroidRuntime(23429): at com.desarrollodroide.libraryfragmenttransactionextended.FragmentTransactionExtended.switchFragments(FragmentTransactionExtended.java:242) 08-18 05:35:42.416: E/AndroidRuntime(23429): at com.desarrollodroide.libraryfragmenttransactionextended.FragmentTransactionExtended.commit(FragmentTransactionExtended.java:295) 08-18 05:35:42.416: E/AndroidRuntime(23429): at screens.MainActivity.onVariantOpen(MainActivity.java:412) 08-18 05:35:42.416: E/AndroidRuntime(23429): at fragments.ProductDetailFragment$1.onClick(ProductDetailFragment.java:82) 08-18 05:35:42.416: E/AndroidRuntime(23429): at android.view.View.performClick(View.java:4147) 08-18 05:35:42.416: E/AndroidRuntime(23429): at android.view.View$PerformClick.run(View.java:17161) 08-18 05:35:42.416: E/AndroidRuntime(23429): at android.os.Handler.handleCallback(Handler.java:615) 08-18 05:35:42.416: E/AndroidRuntime(23429): at android.os.Handler.dispatchMessage(Handler.java:92) 08-18 05:35:42.416: E/AndroidRuntime(23429): at android.os.Looper.loop(Looper.java:213) 08-18 05:35:42.416: E/AndroidRuntime(23429): at android.app.ActivityThread.main(ActivityThread.java:4787) 08-18 05:35:42.416: E/AndroidRuntime(23429): at java.lang.reflect.Method.invokeNative(Native Method) 08-18 05:35:42.416: E/AndroidRuntime(23429): at java.lang.reflect.Method.invoke(Method.java:511) 08-18 05:35:42.416: E/AndroidRuntime(23429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 08-18 05:35:42.416: E/AndroidRuntime(23429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 08-18 05:35:42.416: E/AndroidRuntime(23429): at dalvik.system.NativeStart.main(Native Method) 08-18 05:37:52.766: E/Trace(24471): error opening trace file: No such file or directory (2)

    opened by Gamezpedia 2
  • WINDOWS: clone failed: Filename too long

    WINDOWS: clone failed: Filename too long

    unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/slide_fragment_horizontal_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/slide_fragment_horizontal_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/slide_fragment_horizontal_right_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/zoom_slide_horizontal_tablet_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/zoom_slide_horizontal_tablet_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/zoom_slide_vertical_tablet_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/FragmentTransactionExtended_ASCompat/libraryFragmentTransactionExtended/unspecified/res/animator/zoom_slide_vertical_tablet_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_horizontal_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_horizontal_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_horizontal_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_horizontal_right_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_vertical_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_vertical_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_vertical_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/card_flip_vertical_right_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/glide_fragment_horizontal_in.xml: Filename too long Updating files: 35% (178/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/glide_fragment_horizontal_out.xml: Filename too long Updating files: 36% (179/497) Updating files: 37% (184/497) Updating files: 38% (189/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_horizontal_left_in.xml: Filename too long Updating files: 39% (194/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_horizontal_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_horizontal_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_horizontal_right_out.xml: Filename too long Updating files: 40% (199/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_vertical_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_vertical_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_vertical_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/slide_fragment_vertical_right_out.xml: Filename too long Updating files: 41% (204/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_horizontal_left_int.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_horizontal_left_out.xml: Filename too long Updating files: 42% (209/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_horizontal_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_horizontal_right_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_vertical_left_int.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_vertical_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_vertical_right_in.xml: Filename too long Updating files: 43% (214/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/table_vertical_right_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/zoom_from_left_corner_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/zoom_from_left_corner_left_out.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/zoom_from_left_corner_right_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/zoom_from_left_corner_right_out.xml: Filename too long Updating files: 44% (219/497) unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/zoom_from_right_corner_left_in.xml: Filename too long unable to create file fragmentTransactionExample/build/intermediates/exploded-aar/com.desarrollodroide.libraryfragmenttransactionextended/libraryFragmentTransactionExtended/1.0.0/res/animator/zoom_from_right_corner_left_out.xml: Filename too ...

    opened by mgood7123 0
  • Support for android.support.v4.app.Fragment

    Support for android.support.v4.app.Fragment

    FragmentManager fm = getFragmentManager();
    FragmentTransaction fragmentTransaction = fm.beginTransaction();
    FragmentTransactionExtended fragmentTransactionExtended = new FragmentTransactionExtended(this, fragmentTransaction, firstFragment, secondFragment, R.id.fragment_place);
    fragmentTransactionExtended.addTransition(FragmentTransactionExtended.GLIDE);
    fragmentTransactionExtended.commit();
    

    Does not work with Fragments from android.support.v4.app.Fragment. Can you get it working with that as well?

    opened by vanlooverenkoen 0
  • Should not be adding fragments to backStack by default

    Should not be adding fragments to backStack by default

    There has to be a choice if developer wants to add the fragment to backstack, it adds all the fragments to backstack and there is nothing we can do about it.

    opened by TheMaxCoder 0
  • Tag support added to FragmentTransactionExtended class

    Tag support added to FragmentTransactionExtended class

    There was no way to add tags to the fragment being placed in the container during a FragmentTransactionExtended transaction.

    I created a new constructor that accepts a tag as a String and sets a member variable to it. In the original constructor, I set the member tag to null.

    I changed the fragmentTransaction.add(containerId, fragment) method to fragmentTransaction.add(containerId, fragment, tag) This is flexible, as the fragmentTransaction.add(containerId, fragment) method is actually fragmentTransaction.add(containerId, fragment, null)

    opened by brandonbryan12 0
  • Compatibility issues

    Compatibility issues

    This whole project is build using android.app.fragment. So this project cannot be used when fragments are created using android.support.v4.app.fragment. Is there any way for this project to be compatible with android.support.v4.app.fragment. p.s. i cannot change my project to use android.app.fragment coz i'm using other repo which are built for android.support.v4.app.fragment and also using fragmenttabhost which is a support.v4 widget inside my fragment.

    opened by Tommykewl1995 8
  • Fragment in recreated each time animation is done

    Fragment in recreated each time animation is done

    Hello , Thanks so much for the awesome library.

    I have a problem is that each time I apply the animation I see onCreateView in recalled. meaning that fragment is recreated. As a result all initialization is done again. In my case I have map with markers. Each time I apply animation, markers are redrawn. This causes bad user experience in the app.

    opened by msauditech 0
Owner
Antonio Corrales
Antonio Corrales
Combine ViewPager and Animations to provide a simple way to create applications' guide pages.

WoWoViewPager WoWoViewPager combines ViewPager and Animations to provide a simple way to create applications' guide pages. When users are dragging WoW

Nightonke 2.7k Dec 30, 2022
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.

SuperForwardView About A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix. GIF Design Credi

Ertugrul 77 Dec 9, 2022
DuGuang 1k Dec 14, 2022
[] An Android library which allows developers to easily add animations to ListView items

DEPRECATED ListViewAnimations is deprecated in favor of new RecyclerView solutions. No new development will be taking place, but the existing versions

Niek Haarman 5.6k Dec 30, 2022
An Android library which provides simple Item animations to RecyclerView items

RecyclerViewItemAnimators Library Travis master: This repo provides: Appearance animations Simple animators for the item views Quick start You can now

Gabriele Mariotti 3.1k Dec 16, 2022
Trying to play with Jetpack compose low level animations APIs, which are animate*AsState APIs.

ComposeSimpleAnimation Trying to play with Jetpack compose low level animations APIs, which are animate*AsState APIs that I needed in another project.

Mustafa Ibrahim 39 Dec 10, 2022
Set of extra Transitions on top of Jetpack Transitions Library

Transitions Everywhere Set of extra Transitions on top of AndroidX Transitions Library. About Article about transitions and library Originally this li

Andrey Kulikov 4.9k Dec 30, 2022
Chandrasekar Kuppusamy 799 Nov 14, 2022
Set of extra Transitions on top of Jetpack Transitions Library

Transitions Everywhere Set of extra Transitions on top of AndroidX Transitions Library. About Article about transitions and library Originally this li

Andrey Kulikov 4.8k Apr 27, 2021
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
AndroidPhotoFilters aims to provide fast, powerful and flexible image processing instrument for creating awesome effects on any image media.

PhotoFiltersSDK PhotoFiltersSDK aims to provide fast, powerful and flexible image processing instrument for creating awesome effects on any image medi

Zomato 2.5k Dec 23, 2022
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.

ViewPagerTransforms Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the

Ian Thomas 2.5k Dec 29, 2022
Android library to create complex multi-state animations.

MultiStateAnimation Android library to create complex multi-state animations. Overview A class that allows for complex multi-state animations using An

Keepsafe 405 Nov 11, 2022
Lightweight Android library for cool activity transition animations

Bungee min SDK 16 (Android Jellybean 4.1) written in Java A lightweight, easy-to-use Android library that provides awesome activity transition animati

Dean Spencer 172 Nov 18, 2022
💠Metaphor is the library to easily add Material Motion animations

Metaphor Metaphor is the library to easily add Material Motion animations. Who's using Metaphor? ?? Check out who's using Metaphor Include in your pro

Ranbir Singh 132 Dec 25, 2022
🪐 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
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
Actions for android animations. Inspired by libgdx scene2d actions.

Android Animations Actions Actions for android animations. Inspired by libgdx scene2d actions. The main goal of this project is making creating of com

dtx12 137 Nov 29, 2022