ActSwitchAnimTool make the Animation easy to implements, and it compat the version of Android 4.0 or above.

Overview

ActSwitchAnimTool


As well as we know, Android 5.0 has been support more Animation(just like ViewAnimationUtils~). Maybe some developers can implements the same effect in other way,but it too tedious to implements the same many times in various needs. It's time to build a wheel to solve the problem. ActSwitchAnimTool can compat the version of Android 4.0 or above. And it's convenient to use.

Demo:

Installation

Step 1. Add it in your root build.gradle at the end of repositories.

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Step 2. Add the dependency

dependencies {
    ...
    compile 'com.github.Yellow5A5:ActSwitchAnimTool:1.0.1'
}

Usage

● SPREAD_MODE

1.Keep the first activity.

You can set the second parameter of ActSwitchAnimTool.startActivity to keep the FirstActivity. If you want keep it and show the shrink-Animation, you must take the method of setShrinkBack(true).

Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
mFirstDemoActSwitchAnimTool = new ActSwitchAnimTool(FirstActivity.this).setAnimType(ActSwitchAnimTool.MODE_SPREAD)
        .target(mActSwitchDemoBtn)
        .setShrinkBack(true)
        .setmColorStart(Color.parseColor("#FF5777"))
        .setmColorEnd(Color.parseColor("#FF5777"))
        .startActivity(intent, false);

it will not really startActivity until you take the method of build().

mFirstDemoActSwitchAnimTool.setAnimType(ActSwitchAnimTool.MODE_SPREAD)
		.build();

2.Do not keep the first activity.

if you don't need keep the first activity, you can take the method more clearly like this.

new ActSwitchAnimTool(FirstActivity.this).setAnimType(ActSwitchAnimTool.MODE_SPREAD)
        .target(mActSwitchDemoBtn)
        .setmColorStart(Color.parseColor("#FF5777"))
        .setmColorEnd(Color.parseColor("#FF5777"))
        .startActivity(intent, true)
        .build();

● SHRINK_MODE

Place this code in Second Activity to receive the message.

new ActSwitchAnimTool(this)
        .receiveIntent(getIntent())
        .setAnimType(ActSwitchAnimTool.MODE_SHRINK)
        .target(mDemoFloatingBtn)
        .build();

● Other

◦ CustomCallback

You can set the custom callback like this, but it is in conflict with startActivity. You can change it inside if you want.(I set it at the method of KeyUp(event=keyback) in second Activity. The Animation will appear when I click back.).

new ActSwitchAnimTool(this)
        .setAnimType(ActSwitchAnimTool.MODE_SPREAD)
        .target(mDemoFloatingBtn)
        .setmColorStart(Color.parseColor("#FF5777"))
        .setmColorEnd(Color.parseColor("#FF5777"))
        .setCustomEndCallBack(new ActSwitchAnimTool.SwitchAnimCallback() {
            @Override
            public void onAnimationStart() {
            }

            @Override
            public void onAnimationEnd() {
                finish();
            }

            @Override
            public void onAnimationUpdate(int progress) {

            }
        })
        .build();

◦ AddContainer !

Take your custom view in here, to implements the effect you wanted.

        mShareContainer = new ShareContainer(FirstActivity.this);
        mShareContainer.setIShareCallback(new ShareContainer.IShareCallback() {
            @Override
            public void onCancel() {
                mShareContainer.hideShareBtn();
                shareDemoTool.setAnimType(ActSwitchAnimTool.MODE_SHRINK)
                        .removeContainerView(mShareContainer)
                        .build();
            }
        });
        mShareViewDemoBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDemoTool.setAnimType(ActSwitchAnimTool.MODE_SPREAD)
                        .addContainerView(mShareContainer, new ActSwitchAnimTool.SwitchAnimCallback() {
                            @Override
                            public void onAnimationStart() {

                            }

                            @Override
                            public void onAnimationEnd() {
                                mShareContainer.showShareBtn();
                            }

                            @Override
                            public void onAnimationUpdate(int progress) {

                            }
                        }).
                        build();
            }
        });

Demo-Introduction

I have implemented the ShareContainer.This design is a reference to the idea of Social share by Ронжин Михаил.You can easy to implements it by the AddContainer;

License

Copyright 2016 Yellow5A5

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.
You might also like...
A customised EditText view serving the purpose of taking numeric One Time Password from a user. With stunning animation, and high customizability.
A customised EditText view serving the purpose of taking numeric One Time Password from a user. With stunning animation, and high customizability.

PassCodeText A customised EditText view serving the purpose of taking numeric One Time Password from a user. With stunning animation, and high customi

create your custom themes and change them dynamically with ripple animation
create your custom themes and change them dynamically with ripple animation

Android Animated Theme Manager create your custom themes and change them dynamically with ripple animation Features support java and kotlin projects.

Animation samples with motion layout and object animator 🦹🏻‍♀️
Animation samples with motion layout and object animator 🦹🏻‍♀️

💕 Animations 💕 Animation samples with motion layout and object animator 🦹🏻‍♀️ Car Animation with Object Animator 👀 🎀 I've created this project b

Sophisticated and cool intro with Material Motion Animation
Sophisticated and cool intro with Material Motion Animation

☯️Sophisticated and cool intro with Material Motion Animations(No more viewpager transformer)

FadingToolbar is an animation library which fades out your footer view in a ScrollView/RecyclerView and fades in a toolbar title
FadingToolbar is an animation library which fades out your footer view in a ScrollView/RecyclerView and fades in a toolbar title

FadingToolbar is an animation library which fades out your footer view in a ScrollView/RecyclerView and fades in a toolbar title (analogue of the LargeTitle animation in iOS)

💳 Bank Card View is a simple and elegant card view with Flip animation.
💳 Bank Card View is a simple and elegant card view with Flip animation.

Visualização de cartão bancário 💳 Bank Card View é uma visualização de cartão simples e elegante com animação Flip. Versões Selecione a língua : Engl

💳 Bank Card View is a simple and elegant card view with Flip animation.
💳 Bank Card View is a simple and elegant card view with Flip animation.

Visualização de cartão bancário 💳 Bank Card View é uma visualização de cartão simples e elegante com animação Flip. Versões Selecione a língua : Engl

A component for flip animation on Android, which is similar to the effect in Flipboard iPhone/Android
A component for flip animation on Android, which is similar to the effect in Flipboard iPhone/Android

android-flip Aphid FlipView is a UI component to accomplish the flipping animation like Flipboard does. A pre-built demo APK file for Android OS 2.2+

Deprecated in favour of https://developer.android.com/reference/android/support/v4/view/animation/PathInterpolatorCompat.html

Deprecated: use https://developer.android.com/reference/android/support/v4/view/animation/PathInterpolatorCompat.html instead. android-cubic-bezier-in

Owner
Acropolis
Now you see me cuz I let it be.
Acropolis
Chandrasekar Kuppusamy 799 Nov 14, 2022
DuGuang 1k Dec 14, 2022
Road Runner is a library for android which allow you to make your own loading animation using a SVG image

Road Runner Road Runner is a library for android which allow you to make your own loading animation using a SVG image Sample video View in Youtube Dem

Adrián Lomas 1.2k Nov 18, 2022
Android library to make notes drop animation for music players

VusikView Min SDK 11 Screnshots How to use If you want use this library, you can download project and import it into your workspace and add the projec

Chetan Kaushik 119 Nov 29, 2022
FPSAnimator is very easy animation library for Android TextureView and SurfaceView.

FPSAnimator A simple but powerful Tween / SpriteSheet / ParabolicMotion / animation library for Android TextureView and SurfaceView. Features The cont

Masayuki Suda 756 Dec 30, 2022
This library provides easy ways to add onboarding or pager screens with different animation and indicators.

WalkThroughAndroid Make amazing OnBoarding Screens easily for your app with different colorful animations, fonts, styles, and many more. Customize you

MindInventory 33 Sep 9, 2022
Android ripple animation helper, easy to create Circular Reveal. | Android水波动画帮助类,轻松实现View show/hide/startActivity()特效。(0.4.6)

CircularAnim English | 中文 首先来看一个UI动效图。 效果图是是Dribbble上看到的,原作品在此。 我所实现的效果如下: Watch on YouTube Compile 最新可用版本 So,你可以如下compile该项目,也可以直接把这个类 CircularAnim 拷

ice 2k Nov 19, 2022
Better version of ViewAnimator

CannyViewAnimator CannyViewAnimator is an enhanced version of ViewAnimator. It allows to use Animators and Transitions to extend Visibility. The logic

Live Typing 312 Apr 18, 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
User onboarding library with smooth animation of objects and background colors

SlidingTutorial Cleveroad introduces Sliding Tutorial Library for Flutter Hey guys, hope you haven’t started developing a tutorial for your Flutter ap

Cleveroad 127 Dec 31, 2022