Giter Club home page Giter Club logo

fragmenttransactionextended's Introduction

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.

fragmenttransactionextended's People

Contributors

desarrolloantonio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fragmenttransactionextended's 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.

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.

Gradle

Hey there, how is it going with gradle? Do you know yet when it will be possible to use your library as gradle dependency?

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 ...

Added compatibility with Android API Level 10 and lower

Hi DesarrolloAntonio,

this is not an issue but I want to tell you that I modified your library to be compatible with Android 10 and lower, because my project supports at least Android 10 and I want to add fragment transaction animations to it. I'm not able to create a pull request, but the changes done are quite easy and are the following:

  • I added support library v4 for fragments
  • I added library "NineOldAndroid" for support to animations
  • I changed references for Activity with FragmentActivity of the support library in FragmentTransactionExtended class
  • I changed references for all animation classes of Android with the same of NineOldAndroid library, always in FragmentTransactionExtended class

I have not yet tested these changes, but you could tell me if these changes are valid and reasonable.

Kind regards.

Federico

PS: sorry for my english ;)

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?

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 ๐Ÿ‘

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.