Browser widget background color change

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Browser widget background color change

Post by Youks » Fri Mar 15, 2019 9:57 pm

Hi All,

I have a Browser widget with a custom property to change its background color from white to black. The issue is that on every card opening the browser briefly flickers to white before turning black. I've tried locking the screen or waiting with some time but it persists.

custom property:
<html style="">
<head>
<meta name="viewport" content="device-width, initial-scale=1.0, user-scalable=no"/>
</head>
<body style="background-color: black; color: white; font-family: Arial ; font-size: 17px; line-height: 1.4; text-wrap: normal;">
</body>
</html>

And i set the HTMLTEXT of the Browser to this property.

Anything wrong to this code or method?

Test Done on Note 8 with latest Android.

Best Regards & Thx

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Browser widget background color change

Post by richmond62 » Sat Mar 16, 2019 8:46 am

This is probably a totally goofy suggestion, but . . .

How about setting the backGroundColor of each card to black?

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: Browser widget background color change

Post by Youks » Sat Mar 16, 2019 9:59 am

Hi Richmond,

The background color of the cards is already set to black (no matter the color the flickering is persisting).

Thx

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1999
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser widget background color change

Post by [-hh] » Sat Mar 16, 2019 11:13 am

You could try (in the card script or above it in the message path):

Code: Select all

on preopenCard
  set the htmltext of widget "browser" to \
        "<html style=''><head>" & \
        "<meta name='viewport' content='device-width, " & \
        "initial-scale=1.0, user-scalable=no'/></head>" & \
        "<body style='background-color: black; color: white; " & \
        "font-family: Arial ; font-size: 17px; line-height: 1.4; " & \
        "text-wrap: normal;'></body></html>"
  wait 0.5 seconds with messages --> adjust the time to your needs
end preopenCard
shiftLock happens

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: Browser widget background color change

Post by Youks » Sat Mar 16, 2019 11:50 am

Hi all,

Thank you for your help. It looks like that by default, anytime we invoke the widget it appears first white before taking the color we assign to it. It appears very quickly in white first. I have tried to lock the screen before showing the widget but does not remove that flickering.

Any other hint?

Thanks

Regards

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Browser widget background color change

Post by richmond62 » Sat Mar 16, 2019 11:55 am

I wonder if there is a template of the Browser widget and that could
have its backGroundColor set to black
before any instances of it are made to appear on a card?

Or, just maybe, you could open the browser in the LCB thing and muck around with it there?
-
Screenshot 2019-03-16 at 12.54.49.png

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1999
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser widget background color change

Post by [-hh] » Sat Mar 16, 2019 12:03 pm

Lock screen doesn't work for native displays like the browser widget.
That's why I proposed to set the htmltext on preopenCard (or preopenStack).
This works here on MacOS, Win7+10 and linux.
shiftLock happens

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: Browser widget background color change

Post by Youks » Sat Mar 16, 2019 12:10 pm

This works perfectly on MacOS. The issue is on Android so far.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1999
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser widget background color change

Post by [-hh] » Sat Mar 16, 2019 12:13 pm

Android has a slow processor. You could try to increase the waiting time to 1 second?
shiftLock happens

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Browser widget background color change

Post by richmond62 » Sat Mar 16, 2019 12:16 pm

1 second might be too long for the current
Attention Deficit Generations who fiddle around non-stop
on their Android devices.
-
bonk.jpg
bonk.jpg (11.38 KiB) Viewed 369 times

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: Browser widget background color change

Post by Youks » Sat Mar 16, 2019 12:18 pm

Whatever timing we select the flickering always happens unfortunately.

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: Browser widget background color change

Post by Youks » Sat Mar 16, 2019 12:19 pm

I believe that the widget should have a color property to overcome this issue.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1999
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser widget background color change

Post by [-hh] » Sat Mar 16, 2019 12:25 pm

The default backColor is in libbrowser, so not directly accessible through the LCB code.

But you could instead do a fade-in effect, for example as here:
https://www.abeautifulsite.net/a-clean- ... r-webpages
shiftLock happens

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm
Location: Qatar

Re: Browser widget background color change

Post by Youks » Sat Mar 16, 2019 12:45 pm

Thank you Hermann for the trick but it is unfortunately too complicated for such an easy task.
I hope LC could implement something easier for Android.

Many thanks Gents for trying

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Browser widget background color change

Post by richmond62 » Sat Mar 16, 2019 1:52 pm

Humph . . .

I tried setting the INK of the browser to blendClear,
but that had no effect whatsoever.

Nor did any of the other INK settings have an effect.

Post Reply

Return to “Android Deployment”