Flex Mobile: app resizes when softkeyboard appears but doesn't resizes when it hides

157 views Asked by At

I have a Flex Mobile application, where my ViewNavigatorApplication is set to resizeForSoftKeyboard="true". This, so that the View displayed resizes when the soft keyboard is called.

The view is increadibly simple. As you write on the TextInput, the items of a List will get filtered. So, when you click the TextInput the softKeyboard is raised and the application is resized to that you don't lose part of the screen. This works great but sometimes, when the TextInput loses its focus and the softKeyboard hides, the application won't resize back. This can be solved just by going to the previous View but it should not be happening.

Since I dont have enough reputation to attach an image, I hope you can go to the next link and see a screenshot that shows what I'm trying to explain:

enter image description here

Next is the code of the View:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"        
                 xmlns:s="library://ns.adobe.com/flex/spark"
                 xmlns:componets="componets.*"
                 xmlns:views="views.*">



    <fx:Declarations>
        <s:HTTPService id="getService"                                                                                                
                       requestTimeout="5"
                       method="GET"
                       result="getItemsHandler(event)"/>
        <s:HTTPService id="getItemService"                                                                                                
                       requestTimeout="5"
                       method="GET"
                       result="serviceReturned(event)"
                       fault="serviceReturned(event)"/>
    </fx:Declarations>



    <fx:Script>
        <![CDATA[               
            import com.adobe.serialization.json.JSON;
            import com.adobe.serialization.json.JSONParseError;

            import mx.collections.ArrayCollection;
            import mx.core.IVisualElement;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;

            import singletons.AppConfiguration;
            import valueobjects.data.Contact;


            private var internalConfiguration:AppConfiguration = AppConfiguration.getInstance();                        


            override protected function createChildren():void
            {               
                super.createChildren();
                configureComponents();
                initializeList();
            }

            private function initializeList():void
            {
                if (internalConfiguration.Contacts != null)
                {
                    internalConfiguration.Contacts.filterFunction = filterList;
                    internalConfiguration.Contacts.refresh();
                }                               
                groupList.dataProvider = internalConfiguration.Contacts;                                                
            }                                   

            private function filterList(item:Object):Boolean
            {
                var contact:Contact = item as Contact;              
                var searchText:String = (contact.id + contact.name + contact.lastname).toLowerCase();
                searchText = searchText.toLowerCase();              
                var patern:String = filterText.text.toLowerCase();
                if (searchText.indexOf(patern) > -1)
                    return true;
                else
                    return false;
            }

            /**
             * Handles the retrieved directory data and stores it.
             */
            private function getItemsHandler(event:ResultEvent):void
            {
                BLABLABLA...                
            }

            protected function contactSelected(event:MouseEvent):void
            {   
                if(groupList.selectedIndex == -1)
                {
                    return;
                }
                var person:Contact = groupList.selectedItem as Contact;
                getItemService.request.id = person.id;
                getItemService.request.name = person.name;          
                getItemService.send();              
                groupList.selectedItem = null;
            }

        ]]>
    </fx:Script>


    <s:Group id="componentsGroup"
             width="100%" height="100%">
        <s:Button id="backButton"                         
              click="backHandler()"/>   
        <s:TextInput id="filterText"                     
                     keyUp="internalConfiguration.Contacts.refresh()"/>
        <s:List id="groupList"              
                itemRenderer="components.renderers.ContactRenderer"
                click="contactSelected(event)"
                top="145" left="20" right="20" bottom="20">
        </s:List>
    </s:Group>  

</s:View>

I hope you can help me find why this is happening. It's incredibly annoying and I can't have that kind of behavior on the application. Any tip will be appreciated. Regards,

Sebastián

0

There are 0 answers