Hello amigos 🙂
Today, I will introduce a library which will help you implement animation within your android applications.
It can be used for animating views upon their entering or exiting from an activity.
Moreover, it can also be used for images, buttons, etc.
The following library will be using the view animation tools and their listener’s.

Simply extend the “BaseClass” in your activity and  override the methods.


@Override
public void enterActivity() {
	super.enterActivity();
	TweenAnimation.fromLeft(findViewById(R.id.test1), 1000, 300);
	TweenAnimation.fromRight(findViewById(R.id.test2), 1000, 300);
	TweenAnimation.fromTop(findViewById(R.id.test3), 1000, 300);
	TweenAnimation.fromBottom(findViewById(R.id.test4), 1000, 300);
	TweenAnimation.fromLeft(findViewById(R.id.test5), 1000, 300);
	TweenAnimation.fromRight(findViewById(R.id.test6), 1000, 300);
}


This is the enter activity method. After resuming or when starting the activity, it will execute the above code.


@Override
public void leftActivity() {
	super.leftActivity();
	TweenAnimation.toLeft(findViewById(R.id.test1), 1000, 300);
	TweenAnimation.toRight(findViewById(R.id.test2), 1000, 300);
	TweenAnimation.toTop(findViewById(R.id.test3), 1000, 300);
	TweenAnimation.toBottom(findViewById(R.id.test4), 1000, 300);
	TweenAnimation.toLeft(findViewById(R.id.test5), 1000, 300);
	TweenAnimation.toRight(findViewById(R.id.test6), 1000, 300);
}

This is the exit activity method. After navigation or when exiting the activity, it will execute the above code.

BaseClass

This is the class you should extend to implement the above methods.


public class MainActivity extends BaseClass {

    //when the activity starts
    @Override
    public void enterActivity() {
        super.enterActivity();

        TweenAnimation.fromLeft(findViewById(R.id.test1), 1000, 300);
        TweenAnimation.fromRight(findViewById(R.id.test2), 1000, 300);
        TweenAnimation.fromTop(findViewById(R.id.test3), 1000, 300);
        TweenAnimation.fromBottom(findViewById(R.id.test4), 1000, 300);
        TweenAnimation.fromLeft(findViewById(R.id.test5), 1000, 300);
        TweenAnimation.fromRight(findViewById(R.id.test6), 1000, 300);

    }

    //when you exit the activity or on navigation
    @Override
    public void leftActivity() {
        super.leftActivity();

        TweenAnimation.toLeft(findViewById(R.id.test1), 1000, 300);
        TweenAnimation.toRight(findViewById(R.id.test2), 1000, 300);
        TweenAnimation.toTop(findViewById(R.id.test3), 1000, 300);
        TweenAnimation.toBottom(findViewById(R.id.test4), 1000, 300);
        TweenAnimation.toLeft(findViewById(R.id.test5), 1000, 300);
        TweenAnimation.toRight(findViewById(R.id.test6), 1000, 300);

    }
}


Check it out on Github