Repository for android animations Rx wrapper

Overview

RxAnimations

Download API

RxAnimations is a library with the main goal to make android animations more solid and cohesive.

Download

  compile 'oxim.digital:rxanim:0.9.1'
    
  compile 'io.reactivex:rxandroid:1.2.1'
  compile 'io.reactivex:rxjava:1.2.5'

RxJava version compatibility:

This RxAnimations library is only compatible with rxJava 1 greater than 1.2.x.
If you are using rxJava 1.1.x version, take a look here.

If you are searching for the one compatible with rxJava 2, take a look over here.

Usage

A sample project which provides code examples that demonstrate uses of the classes in this project is available in the sample-app/ folder.

True power of this library is the ability to use animations as an observable asynchronous action.
That enables us to apply regular rxJava APIs on the animations.

It provides a couple of classes such as RxValueAnimator, RxObservableValueAnimator and RxAnimationBuilder.
Moreover, it also provides many regulary used animation methods (static import) such as fadeIn(), fadeOut(), slideIn(), leave() etc.

Examples:

  • Animating multiple views together
        animateTogether(fadeIn(firstView),
                        fadeIn(secondView));
  • Chaining multiple animations seamlessly
        fadeIn(firstView)
            .concatWith(fadeIn(secondView));
  • Simple ValueAnimator usage with RxValueAnimator
        final ValueAnimator opacityAnimator = ValueAnimator.ofFloat(0.f, 1.f);
        RxValueAnimator.from(opacityAnimator, animator -> view.setAlpha((float)animator.getAnimatedValue()))
  • Animating multiple values together with RxObservableValueAnimator
        xObservableAnimator = RxObservableValueAnimator.from(xAnimator);
        yObservableAnimator = RxObservableValueAnimator.from(yAnimator);
        
        Observable.combineLatest(xObservableAnimator.schedule(),
                                 yObservableAnimator.schedule(),
                                 (first, second) -> new Pair(first, second))
                  .subscribe(this::updateView);
  • Defining custom animations with RxAnimationBuilder
        RxAnimationBuilder.animate(view, DURATION)
                          .interpolator(INTERPOLATOR)
                          .fadeIn()
                          .rotate(DEGREES)
                          .translateBy(X, Y)
                          ...
                          .schedule([ | false]);

Animation created with RxAnimationBuilder automatically pretransforms the view, if not set otherwise.
I.e. if fadeIn() is called, views opacity will be set to 0.f before animation starts.

Managing animations

Starting animation - Every animation chain is started when we subscribe to it.
Ending animation - Animations can be easily stopped by unsubscribing animation subscription.

LICENSE

Copyright 2016 Mihael Franceković

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
  • RxAnimationBuilder addPre/PostTransform actions

    RxAnimationBuilder addPre/PostTransform actions

    It would be great if we can add preTransform and postTransform actions to the RxAnimationBuilder, which is called before/after the main animations. Something like this:

    public RxAnimationBuilder addPreTransformAction( Action1<ViewPropertyAnimatorCompat>... actions) {
            Observable.from(actions)
                  .subscribe(action -> this.preTransformActions.add(action));
            return this;
    }
    
    enhancement 
    opened by laszlo-galosi 8
  • NoSuchMethodError

    NoSuchMethodError

    java.lang.NoSuchMethodError: No virtual method lambda$call$1(Lrx/CompletableSubscriber;Landroid/support/v4/view/ViewPropertyAnimatorCompat;)V in class Loxim/digital/rxanim/AnimateOnSubscribe; or its super classes (declaration of 'oxim.digital.rxanim.AnimateOnSubscribe' appears in /data/app/package-app-2/split_lib_dependencies_apk.apk) at oxim.digital.rxanim.AnimateOnSubscribe$$Lambda$2.run(Unknown Source) at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1121) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1171) at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:722) at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:738) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) at android.view.Choreographer.doCallbacks(Choreographer.java:580) at android.view.Choreographer.doFrame(Choreographer.java:549) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) 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:5343) 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:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

    bug 
    opened by pcg92 4
  • Manifest contains unhelpful items

    Manifest contains unhelpful items

    I just tried to add RxAnimations 0.9.0 to my project, and I immediately started getting build errors.

    Error:
    	Attribute application@supportsRtl value=(false) from AndroidManifest.xml:22:9-36
    	is also present at [oxim.digital:rxanim:0.9.0] AndroidManifest.xml:14:9-35 value=(true).
    	Suggestion: add 'tools:replace="android:supportsRtl"' to <application> element at AndroidManifest.xml:19:5-96:19 to override.
    

    This is because the library's AndroidManifest.xml includes values for allowBackup and supportsRtl which don't belong in a library project.

    android:allowBackup="true"
    android:label="@string/app_name"
    android:supportsRtl="true"
    
    bug 
    opened by GrahamBorland 3
  • RxValueAnimator support for RxJava 1.2+

    RxValueAnimator support for RxJava 1.2+

    Recently, RxJava 1.2.0 has been released and they've made some backward-incompatible changes related to Completables, specifically:

    • CompletableSubscriber -> rx.CompletableSubscriber
    • CompletableOnSubscribe -> rx.Completable.OnSubscribe

    After upgrading to it, I'm getting the following gradle build issues on :

    RxValueAnimator.from(myValueAnimator, animator ->{
                  ...
     });
    

    Error:(347, 24) error: cannot access CompletableOnSubscribe class file for rx.Completable$CompletableOnSubscribe not found

    enhancement 
    opened by laszlo-galosi 3
  • RxJava 1.2 compatibility

    RxJava 1.2 compatibility

    Recently, RxJava 1.2.0 has been released and they've made some backward-incompatible changes related to Completables, specifically:

    • CompletableSubscriber -> rx.CompletableSubscriber
    • CompletableOnSubscribe -> rx.Completable.OnSubscribe

    After upgrading to RxJava 1.2, I'm getting the following gradle build issues on :

    RxValueAnimator.from(myValueAnimator, animator ->{
                  ...
     });
    

    Error:(347, 24) error: cannot access CompletableOnSubscribe class file for rx.Completable$CompletableOnSubscribe not found

    opened by laszlo-galosi 0
Owner
Mihael Francekovic
Mihael Francekovic
Wrapper of the ObjectAnimator that can be used similarly to ViewPropertyAnimator

ViewPropertyObjectAnimator Wrapper of the ObjectAnimator that can be used similarly to ViewPropertyAnimator. ViewPropertyObjectAnimator is as easy to

Bartek Lipinski 313 Dec 19, 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
[] 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
Render After Effects animations natively on Android and iOS, Web, and React Native

Lottie for Android, iOS, React Native, Web, and Windows Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations expo

Airbnb 33.5k Jan 4, 2023
Android Transition animations explanation with examples.

UNMAINTAINED No maintainance is intended. The content is still valid as a reference but it won't contain the latest new stuff Android Transition Frame

Luis G. Valle 13.6k Dec 28, 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
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
The lib can make the ActivityOptions animations use in Android api3.1+

ActivityOptionsICS 本项目停止维护 =========== f you are thinking on customizing the animation of Activity transition then probably you would look for Activit

Kale 591 Nov 18, 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
Circle based animations for Android (min. API 11)

CircularTools Circle based animations for Android (min. API 11) Currently implemented: Circular reveal Circular transform Radial reaction Reveal:YouTu

AutSoft 209 Jul 20, 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
AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)

AmirHosseinAghajari 128 Nov 26, 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
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
A mix of random small libraries for Kotlin, the smallest reside here until big enough for their own repository.

klutter Random small libraries, usually extensions making other libraries happier. Versions later than 2.x are for JDK 8 and newer only. Maven Depende

Kohesive 140 Nov 1, 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
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
🌠 Transform into a different view or activity using morphing animations.

TransformationLayout ?? Transform into a different view or activity using morphing animations. Using Transformation motions of new material version. D

Jaewoong Eum 2k Jan 3, 2023
Automatically manipulates the duration of animations dependent on view count. Quicksand .. the more you struggle.

QuickSand When showing a really enchanting explanatory animation to your users, but you know that after a while it'll get tedious and would stop users

Paul Blundell 385 Sep 9, 2022