Skip to content

daneko/SimpleItemAnimator

Repository files navigation

SimpleItemAnimator

This library is provided simple animator on the Recyclerview.

add dependencies

repositories {
    maven { url 'http://daneko.github.io/m2repo/repository' }
}

dependencies {
    compile 'com.github.daneko:simple-item-animator:0.0.1-SNAPSHOT'
}

sample code

// set animation only!
recyclerView.setItemAnimator(
        SimpleItemAnimator.builder().
                preAddAnimationState(v -> {
                    ViewCompat.setAlpha(v, 1);
                    ViewCompat.setScaleX(v, 0);
                    ViewCompat.setScaleY(v, 0);
                    return Unit.unit();
                }).
                addAnimation(animator -> animator.scaleX(1).scaleY(1)).
                addDuration(500).
                removeAnimation(animator ->
                        animator.translationXBy(recyclerView.getWidth())).
                preChangeAnimationState((oldV, newVOpt, param) -> {
                    ViewCompat.setAlpha(oldV, 1);
                    newVOpt.foreach(newV -> {
                        ViewCompat.setAlpha(newV, 0);
                        ViewCompat.setRotationX(newV, -180);
                        return Unit.unit();
                    });
                    return Unit.unit();
                }).
                changeAnimation(
                        (forOld, param) -> forOld.rotationX(180).alpha(0),
                        (forNew, param) -> forNew.rotationX(0).alpha(1)).
                isChangeAnimationMix(false).
                changeDuration(500).
                build());

use library

and com.android.support:recyclerview-v7:21.0.3

use library in sample app

local.properties sample

sdk.dir=/usr/local/opt/android-sdk
java8_home=/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
java7_home=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home

License

(The MIT License)

Copyright (c) 2014 daneko

About

for RecyclerView#setItemAnimator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published