plattysoft / Leonids

A Particle System for standard Android UI: http://plattysoft.github.io/Leonids/
Apache License 2.0
2.28k stars 396 forks source link

documents on initialization lacking #25

Closed ynkm169 closed 9 years ago

ynkm169 commented 9 years ago

the constructor

new ParticleSystem

should only be called after your view is loaded and positioned. Nothing is mentioned. Took me a while to find out.

If you do it inside activity construction, it will make emitter coordinates always 0,0 int[] location = new int[2]; emiter.getLocationInWindow(location);

ynkm169 commented 9 years ago

i changed it to this and now it is working...

@Override
public void onWindowFocusChanged (boolean hasFocus) {
    ViewGroup button = (ViewGroup) findViewById(R.id.emitterParent);
    for (int i = 0; i < button.getChildCount(); i++) {
        new ParticleSystem(this, 1000, R.drawable.particlestar, 600, R.id.drawingBg)        

        .emit(button.getChildAt(i), 50);
    };
}
plattysoft commented 9 years ago

Yes, it is explained in the response to issue #22 and #21

Maybe it is a good idea to add it to the documentation.