My codename app has master/detail layout.
A TableLayout is used for that, in landscape mode.
It is used also in portrait mode with different proportions.

If the app starts in landscape mode, the master and the detail are visible, 
and subsequent orientation changes are handled correctly and the user 
interface is succesfully reconstructed.

If the app starts in portrait mode, only the master is visible by design 
(that's OK) but after the orientation change the user interface is not 
reconstructed completely
because
the master is just at full size, while the detail is not reconstructed.

This is the code of a method that is called at startup and when orientation 
changes:

private void setContainers()
{
    mainEditingContainer.remove();

//these lines are to handle fab correctly
    if (fabBoundContainer!=null) fabBoundContainer.remove();
    if (fabFirstTime) 
{fabBoundContainer=fab.bindFabToContainer(itemListContainer);}


//mainForm.setLayout(BoxLayout.x()); not useful to reset the TableLayout

//the issue is present also without these revalidations
    mainEditingContainer.revalidate();
    editingContainer.revalidate();
    fabBoundContainer.revalidate();   
    mainForm.revalidate();

    if (isPortrait() && conditions)  //not relevant here
    {
        new EditingForm(appData,myData,mainForm,editingContainer,other 
parameters).show();
      }

    if (isPortrait() && !(conditions)) { // only the master in this mode
        //tl=new TableLayout(1,2);         not useful
        //mainForm.setLayout(tl);         not useful

        
mainForm.add(tl.createConstraint().heightPercentage(100).widthPercentage((int) 
(1 * 100)), fabBoundContainer);
    }

    if(isTablet() && !isPortrait() ) {    //master-detail in landscape mode
        //tl=new TableLayout(1,2);    not useful
        //mainForm.setLayout(tl);    not useful
        
        
mainForm.add(tl.createConstraint().heightPercentage(100).widthPercentage((int) 
(leftContainerRatio * 100)), fabBoundContainer).add(mainEditingContainer);
    }

    mainEditingContainer.revalidate();
    editingContainer.revalidate();
    fabBoundContainer.revalidate();
    mainForm.revalidate();

    if (fabFirstTime) fabFirstTime=false;
}

Some commented lines are with some tentative workaround but not successful.

What's wrong? How can I achieve the complete reconstruction of UI in 
landscape mode, when the app is started in portrait and then rotates? 
I remind you that if the app starts in landscape mode, there are no issues 
at any subsequent device rotation (just a BrowserComponent is not resizing, 
this will be addressed separately).
Thanks in avance

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/78465634-8c90-49c3-8bdb-e3341964969bn%40googlegroups.com.

Reply via email to