function AndroidDetectWindowSize()
{
  $("sizing-body").setStyle({overflow: "hidden"});

  /* This is shown to make sure we can scroll the address bar off.  It goes outside
   * of #sizing-body, so it's not clipped.  By not changing #sizing-body itself, we
   * avoid reflowing the entire document more than once, when we finish. */
  this.padding = document.createElement("DIV");
  this.padding.setStyle({width: "1px", height: "5000px"});
  this.padding.style.visibility = "hidden";
  this.padding.hide();
  document.documentElement.appendChild(this.padding);

  this.window_size = [0, 0];
  this.finish = this.finish.bind(this);
  this.event_onresize = this.event_onresize.bindAsEventListener(this);

  this.finish_timer = null;
  this.last_window_orientation = window.orientation;

  window.addEventListener("resize", this.event_onresize, true);

  this.active = false;

  /* Kick off a detection cycle.  On Android 2.1, we can't do this immediately after onload; for
   * some reason this triggers some very strange browser bug where the screen will jitter up and
   * down, as if our scrollTo is competing against the browser trying to scroll somewhere.  For
   * older browsers, delay before starting.  This is no longer needed on Android 2.2. */
  var delay_seconds = 0;
  var m = navigator.userAgent.match(/Android (\d+\.\d+)/);
  if(m && parseFloat(m[1]) < 2.2)
  {
    debug("Delaying bootstrapping due to Android version " + m[1]);
    delay_seconds = 1;
  }

  /* When this detection cycle completes, a resize event will be fired so listeners can
   * act on the detected window size. */
  this.begin.bind(this).delay(delay_seconds);
}
/*
 * AndroidDetectWindowSize
 *
 * Implementing a full-page web app for Android is hard, because if you set the page to
 * "width: 100%; height: 100%;" it'll eat a big chunk of the screen with the address bar
 * which can't be scrolled off in that configuration.  We have to play games to figure out
 * the real size of the window, and set the body size to it explicitly.  This handler does
 * the following:
 *
 * - capture resize events
 * - cancel the resize event; we'll fire it again when we're done
 * - enable a large padding div, to ensure that we can scroll the window downward
 * - window.scrollTo(0, 99999999) to scroll the address bar off screen, which increases the window
 *   size to the maximum.  We use a big value here, because Android has a broken scrollTo, which
 *   animates to the specified position.  If we say (0, 1), then it'll take a while to scroll
 *   there; by giving it a huge value, it'll scroll past the scrollbar in one frame.
 * - wait a little while.  We need to wait for one frame of scrollTo's animation, but we don't
 *   know how long that'll be, so we need to poll with a timer periodically, checking
 *   document.body.scrollTop.
 * - set the body to the size of the window
 * - hide the padding div
 * - synthesize a new resize event to continue other event handlers that we originally cancelled
 *
 * resize will always be fired at least once as a result of constructing this class.
 *
 * This is only used on Android.
 */
AndroidDetectWindowSize
Implementing a full-page web app for Android is hard, because if you set the page to
"width: 100%; height: 100%;" it'll eat a big chunk of the screen with the address bar
which can't be scrolled off in that configuration.  We have to play games to figure out
the real size of the window, and set the body size to it explicitly.  This handler does
the following.

- capture resize events
- cancel the resize event; we'll fire it again when we're done
- enable a large padding div, to ensure that we can scroll the window downward
- window.scrollTo(0, 99999999) to scroll the address bar off screen, which increases the window
size to the maximum.  We use a big value here, because Android has a broken scrollTo, which
animates to the specified position.  If we say (0, 1), then it'll take a while to scroll
there; by giving it a huge value, it'll scroll past the scrollbar in one frame.
- wait a little while.  We need to wait for one frame of scrollTo's animation, but we don't
know how long that'll be, so we need to poll with a timer periodically, checking
document.body.scrollTop.
- set the body to the size of the window
- hide the padding div
- synthesize a new resize event to continue other event handlers that we originally cancelled

resize will always be fired at least once as a result of constructing this class.

This is only used on Android.
AndroidDetectWindowSize Implementing a full - page web app for Android is hard because if you set the page to " width : 100% ; height : 100% ; " it ' ll eat a big chunk of the screen with the address bar which can ' t be scrolled off in that configuration . We have to play games to figure out the real size of the window and set the body size to it explicitly . This handler does the following . - capture resize events - cancel the resize event ; we ' ll fire it again when we ' re done - enable a large padding div to ensure that we can scroll the window downward - window . scrollTo ( 0 99999999 ) to scroll the address bar off screen which increases the window size to the maximum . We use a big value here because Android has a broken scrollTo which animates to the specified position . If we say ( 0 1 ) then it ' ll take a while to scroll there ; by giving it a huge value it ' ll scroll past the scrollbar in one frame . - wait a little while . We need to wait for one frame of scrollTo ' s animation but we don ' t know how long that ' ll be so we need to poll with a timer periodically checking document . body . scrollTop . - set the body to the size of the window - hide the padding div - synthesize a new resize event to continue other event handlers that we originally cancelled resize will always be fired at least once as a result of constructing this class . This is only used on Android .
function AndroidDetectWindowSize()
{
  $("sizing-body").setStyle({overflow: "hidden"});
  this.padding = document.createElement("DIV");
  this.padding.setStyle({width: "1px", height: "5000px"});
  this.padding.style.visibility = "hidden";
  this.padding.hide();
  document.documentElement.appendChild(this.padding);
  this.window_size = [0, 0];
  this.finish = this.finish.bind(this);
  this.event_onresize = this.event_onresize.bindAsEventListener(this);
  this.finish_timer = null;
  this.last_window_orientation = window.orientation;
  window.addEventListener("resize", this.event_onresize, true);
  this.active = false;
  var delay_seconds = 0;
  var m = navigator.userAgent.match(/Android (\d+\.\d+)/);
  if(m && parseFloat(m[1]) < 2.2)
  {
    debug("Delaying bootstrapping due to Android version " + m[1]);
    delay_seconds = 1;
  }
  this.begin.bind(this).delay(delay_seconds);
}
function AndroidDetectWindowSize ( ) { $ ( "sizing-body" ) . setStyle ( { overflow : "hidden" } ) ; this . padding = document . createElement ( "DIV" ) ; this . padding . setStyle ( { width : "1px" , height : "5000px" } ) ; this . padding . style . visibility = "hidden" ; this . padding . hide ( ) ; document . documentElement . appendChild ( this . padding ) ; this . window_size = [ 0 , 0 ] ; this . finish = this . finish . bind ( this ) ; this . event_onresize = this . event_onresize . bindAsEventListener ( this ) ; this . finish_timer = null ; this . last_window_orientation = window . orientation ; window . addEventListener ( "resize" , this . event_onresize , true ) ; this . active = false ; var delay_seconds = 0 ; var m = navigator . userAgent . match ( / Android (\d+\.\d+) / ) ; if ( m && parseFloat ( m [ 1 ] ) < 2.2 ) { debug ( "Delaying bootstrapping due to Android version " + m [ 1 ] ) ; delay_seconds = 1 ; } this . begin . bind ( this ) . delay ( delay_seconds ) ; }
AndroidDetectWindowSize
 Implementing a full-page web app for Android is hard, because if you set the page to
 "width: 100%; height: 100%;" it'll eat a big chunk of the screen with the address bar
 which can't be scrolled off in that configuration.
AndroidDetectWindowSize Implementing a full - page web app for Android is hard because if you set the page to " width : 100% ; height : 100% ; " it ' ll eat a big chunk of the screen with the address bar which can ' t be scrolled off in that configuration .
/* This is shown to make sure we can scroll the address bar off.  It goes outside
   * of #sizing-body, so it's not clipped.  By not changing #sizing-body itself, we
   * avoid reflowing the entire document more than once, when we finish. */ /* Kick off a detection cycle.  On Android 2.1, we can't do this immediately after onload; for
   * some reason this triggers some very strange browser bug where the screen will jitter up and
   * down, as if our scrollTo is competing against the browser trying to scroll somewhere.  For
   * older browsers, delay before starting.  This is no longer needed on Android 2.2. */ /* When this detection cycle completes, a resize event will be fired so listeners can
   * act on the detected window size. */