fullscreenmode and rect of a substack on mobile device ?

Sannyasin Brahmanathaswami brahma at hindu.org
Sun Aug 19 22:37:00 EDT 2018


@Brian and all > glad this opened an important discussion..

and thank to the attempt to make it work @Brian footer control were too far down on that card(android)

Many of cards in the SivaSiva app, would need major geometry refactoring (month(s) of work) without fullScreenMode...so I am not considering give that up. Any appreciation the on going discussion .

But a browsers are integral to app, with HTML5 "presentions" coming and slideshow.

I wanted "responsive to any screen size on all devices"  for a simple browser stack with has a "body" (browser widget) and 5 controls on the bottom -- group "footer" why? we want cover the whole screen, with "pillar boxes"  and the CSS will do the "real" positioning.

in the surface is appear that one does not need:

 FullScreenMode / mobileSetFullScreenRectForOrientations
orientationChanged

"Intuitively" resize stack is all that is required.
And, "intuitively" a group should place all controls relative to itself.

And it does on iOS

see:

go  stack url "http://wiki.hindu.org/uploads/BrowserLandscapeTest_r8.livecode"<http://wiki.hindu.org/uploads/BrowserLandscapeTest_r8.livecode>

without line 14, it works iOS


on preOpenCard

if isMobile() then

    mobileSetAllowedOrientations "portrait,portrait upside down,landscape left,landscape right"

end if

end preOpenCard

on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight

# check it is landscape, turn off the navigation Bar

    if pNewWidth > pNewHeight then -- landscape

        put 0, 0, pNewWidth, pNewHeight into tBrowserRect

        hide group "footer"

    else

        put 0, 0, pNewWidth, pNewHeight - 50 into tBrowserRect

  #line14       # set loc group "footer" to (pNewWidth/2,pNewHeight-25)

        show group "footer"

    end if

    set the rect of widget "body" of me to tBrowserRect

end resizeStack

function isMobile

    return environment() = "mobile"

end isMobile

But the group "footer" was no appearing on Android.

Jacque had her finger on it with this comment.

Jacque (off list)

"I see. That looks like a redraw problem. The resizeStack handler is working but the redraw fails. I did notice the icons were missing but didn't try to figure out why. A quick test says the footer is visible in portrait and false in landscape, but it isn't being drawn to screen for some reason. I think that's the bug to report."

My "gut" told me "we just have to make footer redraw"

This "gut" said: give the loc and it will redraw


on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight

# check it is landscape, turn off the navigation Bar

    if pNewWidth > pNewHeight then -- landscape

        put 0, 0, pNewWidth, pNewHeight into tBrowserRect

        hide group "footer"

    else

        put 0, 0, pNewWidth, pNewHeight - 50 into tBrowserRect

        set loc group "footer" to (pNewWidth/2,pNewHeight-25)

        show group "footer"

    end if

    set the rect of widget "body" of me to tBrowserRect

end resizeStack

and Bingo! It work on iOS and Android! (if someone could try in an android tablet I would appreciate), so it works, and I have a bug to report.

But responsive screen in 19 lines of code! The child controls-the widget in the footer can stay where to are, in portrait, regardless on screen size/ration, there is no reason to "work it that hard"

Brahmanathaswami






On 8/19/18 1:21 PM, Brian Milby via use-livecode wrote:

I did figure out that within preOpenCard, the reported stack rect is still
the dimensions of the saved stack file (at least on iOS).  There is also
the detail that when you hide a group, it sets all of the objects to hidden
which has to be undone in a loop.  I've worked out moving the group and the
background grc, still looking at the math for the widget buttons.  This
would probably be a good place for the Navigation Bar with the option to
select none of the icons (PR submitted, still pending).




More information about the use-livecode mailing list