An Amazing Explode Animation
This is an explode animation. When I first saw the repository ExplosionField, I was so
surprised and wanted to write it by myself. So I did it.
What else ?
I refactored the project, and you can implement your particles easily. And I also made an ExplosionLayout.
Use it in your activity onCreat():
ExplosionField mExplosionField = ExplosionField.attach2Window(this);Then use the explode(Context context, View view,Particle particle) to explode your View.
mExplosionField.explode(MainActivity.this, view, new ExplodeParticle());And you can explode all of views even the groupviews.
I made some particles like
ExplodeParticle
FlyAwayParticle
RightParticle
LeftParticle.
And you also can make your own particles by defining their moving.
Extends the class Particle
public class ExplodeParticle extends Particle {
}And you need to implement advance(float fraction) and newInstance().
public void advance(float fraction) {
...
}
@Override
public Particle newInstance() {
return new ExplodeParticle();
}There are some things you should be known, when you are creating ExplosionLayout.
- There must be one childview.
- You need to use
ExplosionLayoutin you listview item xml.
Create a ExplosionLayout.
<com.gejiahui.library.explosionanimation.ExplosionLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:id="@+id/layout">
<!-- What you want to show-->
</com.gejiahui.library.explosionanimation.ExplosionLayout>Implement ExplosionLayout.OnDeleteListener() in your listview adapter.
like this:
Viewgroup.setOnDeleteListener(new ExplosionLayout.OnDeleteListener() {
@Override
public void onDelete() {
mDatas.remove(position);
mColor.remove(position);
notifyDataSetChanged();
});I know my English is poor , and thank you to watch this README.md. You can see more details by download the code.
I am an android developer in China.

