android+switch+动画,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:

demo_show1.gif

5ed2ce54c96ada2d1aefc422e21405f4.gif

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;

5ed2ce54c96ada2d1aefc422e21405f4.gif

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.

Requires Unity 5.3.0 or higher. Make Skeleton & Vertex Animations right inside the Unity Editor. [New Online Manual] [v1.9.1] Constraints System Skele: Character Animation Toolssignificantly speeds up animator/indie's animation workflow in several ways: 1. Enable developers to make / modify character animations in UnityEditor. Reduce software switching and tedious import/export/split work 2. [BETA] Integrated Timeline editorGreatly accelerate authoring productivity for complex multi-character scenes (cutscenes / finishing moves / etc) 3. Mesh-Morpher tools to make blendshape-like animations without bones 4. Export skinned meshes and animations as DAE archive 5. Utilize the clips you bought from store, modify them to your needs, convert clip type, export to external softwares, etc. 6. Constraints system working in both edit-mode & game-mode. 7. Spline Editor to edit movement path. ******************* Humanoid rig needs special treatment:Please read the two FAQ posts: (1)How to Edit Humanoid clips? (2)Best workflow for Humanoid models? ******************* Main Features: 1. Make animation for your rigged characters with FK/IK support. flag, stick, dragon, ghost, mech, bird, fish, robot, human... you could manipulate ANY rigged models. 2. Modify animations. Modify Generic/Legacy animations directly; with our converter, you could also modify and export clips you bought from assetstore too. Modify and get the result immediately. 3. Make blendshape-like vertex animations directly in Unity Editor. 4. Integrated with Timeline Editor [BETA]. Edit the cutscene right inplace, and easily integrate with code/fx/audio/gui/etc. 5. Visualize the bone link, the vertices, and bone weights, etc. 6. Reduce the folder size, you don't need to include duplicate meshes for each animation. 7. Make/Save/Load poses on disk 8. Convert MuscleClip(Humanoid clip) to and fro Legacy/Generic clip 9. Generate RootMotion from RootBone curves 10. Export character mesh and character ani
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值