You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Jan Velecký <VV...@seznam.cz> on 2014/07/05 10:44:38 UTC

Why CordovaPlugin doesn't implementing powerful event such as onCofigurationchanged or onSizeChanged?

Hello,
This is the key for new plugins, which can be more powerful, because they 
would known what is situation around them.

One example for all. AdMob plugin for Android. AdMob for Android when using 
Smart banner size need to be recreated after screen rotation, but plugin 
don't have any choice to determine it. But one is there, use 
deviceOrientationListener, but this is monstrous solution for this primitive
goal. (It is fire everytime, when device change it's rotation by degree... 
Not only when is screen rotation changed, so this solution have too much 
overhead.)
There are Javascript solution to listen to orientationchange event, but it 
is superfluous call over the bridge between Java and Javascript in 
application.

I think Cordova plugin should provide this general purpose events to be 
again better.

Nice day,
Jan Velecký.

Re: Why CordovaPlugin doesn't implementing powerful event such as onCofigurationchanged or onSizeChanged?

Posted by Andrew Grieve <ag...@chromium.org>.
For onSizeChanged, I think you can use addOnLayoutChangedListener().

onConfigurationChanged seems reasonable though. Filed this as
https://issues.apache.org/jira/browse/CB-7085


On Sat, Jul 5, 2014 at 4:44 AM, Jan Velecký <VV...@seznam.cz> wrote:

> Hello,
> This is the key for new plugins, which can be more powerful, because they
> would known what is situation around them.
>
> One example for all. AdMob plugin for Android. AdMob for Android when using
> Smart banner size need to be recreated after screen rotation, but plugin
> don't have any choice to determine it. But one is there, use
> deviceOrientationListener, but this is monstrous solution for this
> primitive
> goal. (It is fire everytime, when device change it's rotation by degree...
> Not only when is screen rotation changed, so this solution have too much
> overhead.)
> There are Javascript solution to listen to orientationchange event, but it
> is superfluous call over the bridge between Java and Javascript in
> application.
>
> I think Cordova plugin should provide this general purpose events to be
> again better.
>
> Nice day,
> Jan Velecký.