natario1 / ZoomLayout

2D zoom and pan behavior for View hierarchies, images, video streams, and much more, written in Kotlin for Android.
https://natario1.github.io/ZoomLayout
Apache License 2.0
1.03k stars 148 forks source link

Open ZoomEngine constructor without View #190

Closed coffeemakr closed 3 years ago

coffeemakr commented 3 years ago

Problem to be addressed

It is not possible to implement custom views in the same manner as the ZoomImageView outside of the library module because the constructor(context) for ZoomEngine is internal. It is not possible to use the constructor(context, view) before the view has been constructed.

Describe the solution you'd like

It would be nice to have the constructor and the setContainer method public, so that custom views could be implemented outside of the library.

markusressel commented 3 years ago

Thx for mentioning that. I think @natario1 intends to open the ZoomEngine to public, but I am not sure if before v2. If he is fine with opening this up right now, you could open a PR for that.

natario1 commented 3 years ago

This is just to implement ZoomApi by engine?

If you do this change please modify setContainer() so that it can only be called once (throw an error if called twice). And we must also throw readable errors in other parts of the code if setContainer() was not called. container is a lateinit var and it might be null.