Mobile Rotation Redux

Brian Milby brian at milby7.com
Sat Sep 1 02:35:22 EDT 2018


As I like to do, I decided to really over-do the demo test stacks.  The one
I mentioned initially is:

https://milby.us/lc/RotationDemo.livecode

The one I just finished working on does a bit more:

https://milby.us/lc/MobileDemo.livecode

I built both to test resizeStack and rotation on Android.  I only have a 5"
Fire, so I only was able to test on one device.  The first stack is just a
log field and a browser widget.  Nothing special, but it does log the rect
every time a resize happens (rotation).  When the app opens, you will
notice the rect of the stack is the one from the desktop version.  It is
saved at 320x480 on purpose to ensure that just about every device will
need to resize it.

The second stack also is built at 320x480.  That one does a couple of
things.  Depending on the screen width, the buttons are either in a single
row or two rows for each group.  The first group sets the FullScreenMode
(FSM) of the stack.  The stack will store the last mode set and restore
that mode when relaunching (I got that idea from the other thread).  The
second group will set the size of the stack.  Those buttons only have an
effect if one of the FSMs is in use (i.e. not "empty"). The currently
active mode and size are outlined in red.

The stack rect is outlined in red with a Cantaloupe background fill.  The
screen rect is outlined in green with a Mocha fill (only visible in
"showAll" mode).  On my device, I used a 200ms delay to adjust the screen
rect graphic when changing orientation.  I could probably take it down a
little bit more.  If your device is slower on the rotate and that rect does
not adjust, you can lay the device flat (face up) and it should notice the
change and fix it.  I did not attempt to use any of the new messages for
FSM rotation so everything gets really small when you rotate while using a
FSM.  (In my mind the two really don't go together -

The stack initially will launch with FSM empty which means that it will
fill the screen.  The rect does get set to the effective working screenrect
automatically, but I noticed some strangeness when moving to another mode.
To address that issue on my device, I manually changed the stack rect to
320x480 and then back to the effective working screenrect.  That seems to
allow changing to other modes without difficulty.

What is it good for?  Two things.  First is to test messages on various
devices.  Specifically to see when the new rect is available and what the
device thinks various rects are.  Second is an interactive test of how FSM
will adjust a stack on a device.  When you select a mode, it will resize
the stack to the native resolution of the device.  The size buttons can
then be used to set the size that you would be developing the stack in.
I've used the default iPhone/iPad sizes to provide a sample, but they can
be changed without too much difficulty (names would need to be changed in
the code, but the 5 size button labels can be changed independently without
needing to update the code).

In the other thread (actually the start of it), there was a question about
how to get a background object to fill the screen in FSM.  The mocha/green
object is the one that does that here.  To see the effect, use the
"showAll" mode and select the iPad size.  On the 5" Fire, everything is
really small at that size.  It becomes quite obvious when you rotate since
much of the screen space is "extra".

Hope it is helpful for someone.  I had fun making it as my first stab at
Android work.

Brian

On Fri, Aug 31, 2018 at 1:26 PM J. Landman Gay via use-livecode <
use-livecode at lists.runrev.com> wrote:

> On 8/30/18 8:46 PM, Brian Milby via use-livecode wrote:
> > I'll post the stack file if anyone wants to see it.  On the one Android
> > device I have available it works correctly.  Resizestack handlers fire
> > correctly.  So I guess I need to find something with a later OS to test
> > against to see the problems others are seeing on the Android side.
>
> Sure, post the stack and I'll take a look on a couple of different
> Android devices.
>
> For the record, I haven't had any problems on Android with resizeStack
> or the various rects either. I don't remember exactly, but I seem to
> recall the reported problems were with a stack that uses fullscreenMode,
> where resizeStack isn't sent (unless
> mobileSetFullScreenRectForOrientations is used.)
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list