MatteoBattilana / WeatherView

WeatherView is an Android Library let you make cool weather animations for your app
Apache License 2.0
506 stars 81 forks source link

Abide by parent view clipping requests #8

Closed magneticflux- closed 7 years ago

magneticflux- commented 7 years ago

Currently, the ParticleSystem is initialized inside of android.R.id.content, which is effectively the entire screen. This means that particles can stray outside of the parent view even when android:clipChildren="true" is set.

To alleviate this, the WeatherView class should extend FrameLayout so that the ParticleField can be inserted in it at runtime by Leonids. Then, this should be passed when creating a ParticleSystem.

MatteoBattilana commented 7 years ago

Hi, thank you for being interested in WeatherView library. I've tested the library and the particles can stay outside of the parent view even when android:clipChildren="true" is set.

I can't understand your solution. Can you give more information?

magneticflux- commented 7 years ago

The solution I added to my fork gets the parent view of the WeatherView and casts it to a ViewGroup, which it gives to the ParticleSystem. The ParticleSystem then adds a ParticleField view to the parent ViewGroup on which it draws the particles. This means that the Canvas that the particles are drawn on is clipped to the parent of the WeatherView. There is no visible change to the demo app since the WeatherView used there covers the entire screen. Tonight (10h away) I will try a modified method of this that I believe will solve some issues with emitter positions and offsets.