Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    134
    Vote Rating
    1
    stefankendall is an unknown quantity at this point

      0  

    Default Sencha Touch 2.0.1.1 does not respect WebView resize

    Sencha Touch 2.0.1.1 does not respect WebView resize


    I'm trying to add AdMob ads to android.

    When the ad loads, it covers up the bottom of my application. If I switch the orientation, everything re-renders correctly. This must mean that the WebView is the right size, but Sencha Touch isn't respecting the size change, right?

    Is this a known issue? Is there any way to fix this?

    This override was suggested around the internet, but it doesn't do anything:

    Code:
    Ext.define('Ext.viewport.Override', {
        override: 'Ext.viewport.Default',
        onResize: function () {
            var oldWidth = this.windowWidth,
                oldHeight = this.windowHeight,
                width = this.getWindowWidth(),
                height = this.getWindowHeight(),
                currentOrientation = this.getOrientation(),
                newOrientation = this.determineOrientation();
    
    
            if (oldWidth !== width || oldHeight !== height || currentOrientation !== newOrientation) {
                this.fireOrientationChangeEvent(newOrientation, currentOrientation);
            }
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,346
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tried a newer release to see if bug fixes haven't fixed it?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    134
    Vote Rating
    1
    stefankendall is an unknown quantity at this point

      0  

    Default


    Generally upgrading ST breaks my application, but I'll see if I can't get it booting to test the ad resize.

  4. #4
    Sencha User
    Join Date
    Apr 2011
    Posts
    134
    Vote Rating
    1
    stefankendall is an unknown quantity at this point

      0  

    Default


    Attempting to load ads in 2.2b1 causes the entire app to freeze and trigger the "App is not responding. Would you like to close it?" prompt.

    Is there any way I can watch for a WebView resize and trigger an orientation change manually?

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    134
    Vote Rating
    1
    stefankendall is an unknown quantity at this point

      0  

    Default


    This is a crap hack, but it works.

    Code:
        app.WINDOW_HEIGHT = window.innerHeight;
        setInterval(function () {
            if (app.WINDOW_HEIGHT !== window.innerHeight) {
                app.WINDOW_HEIGHT = window.innerHeight;
                Ext.Viewport.fireEvent('orientationchange');
            }
        }, 500);

Thread Participants: 1