PDA

View Full Version : Android is resizing the viewport



Saskia
23 Oct 2013, 1:14 AM
Hello,

I am developing a complex application with ExtJS 4.1.3 which must be usable on desktop and on tablets. (I know there is Sencha Touch but I don't want to develop 2 applications).

Everything works fine except that the android keyboard is shrinking the layout of the viewport. Thus, many recalculations of the layout are taking place.

Is there any possibility to avoid the shrinking of the viewport while using the android browser?

With best thanks
Saskia

scottmartin
24 Oct 2013, 1:47 PM
I am not sure if there is anything you can do about this. You would have to detect the loading of the KB .. I have not tried this in Ext.

Scott.

ettavolt
25 Oct 2013, 2:35 AM
Under similar circumstances I've modified fireResize (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.container.Viewport-method-fireResize) method to prevent shrinking in one dimension if not expanding in other (to allow orientation change).

Saskia
29 Oct 2013, 12:13 AM
I actually found the same solution, ettavolt.
Here is my code:


fireResize : function(width, height){
if( navigator.userAgent.indexOf("Android") >= 0 || navigator.userAgent.indexOf("iP") >= 0) {
if(width === this.width)
return false;
else
this.setSize(width, height);
} else {
if (width != this.width || height != this.height) {
this.setSize(width, height);
}
}
}