JSON and roKeyboardScreen

Hello all, I’ve just begun roku development.

#1, There is a ParseJSON function. Is there an EncodeJSON? Thanks to TheEndless for his SimpleJSON library, but it should be built in.
#2. No matter what I try, I just can’t seem to recolor the top portion of a roKeyboardScreen. What am I missing?

Thanks!

There is no EncodeJSON function in the SDK at present. As for the color of the top part of the keyboard screen, do you mean the overhang area?

Yes, the overhang area.

“RokuRobB” wrote:
There is no EncodeJSON function in the SDK at present. As for the color of the top part of the keyboard screen, do you mean the overhang area?

You can replace the overhang for that specific screen by calling roAppManager.SetThemeAttribute(“OverhangSliceHD”, “background_image”) where background_image is simply an image with the same color as the desired keyboard screen background. Then when navigating to other screens, call SetThemeAttribute again to set the overhang back to the original value. You can do this for the SD case as well by setting the OverhangSliceSD apptheme attribute.

I’m setting the OverhangSliceHD attribute in the theme, but it’s not showing up. I guess there’s an issue with the image? The size of overhang.png is 1281x165…

I’ve tried calling SetThemeAttribute. I’ve tried changing the size of the overhang png from 1281x165 to 1280x138. None of it works. The overhang for the keyboard screen is still an ugly white-blue gradient.

Can anyone help me out here?

“RokuRobB” wrote:
You can replace the overhang for that specific screen by calling roAppManager.SetThemeAttribute(“OverhangSliceHD”, “background_image”) where background_image is simply an image with the same color as the desired keyboard screen background. Then when navigating to other screens, call SetThemeAttribute again to set the overhang back to the original value. You can do this for the SD case as well by setting the OverhangSliceSD apptheme attribute.

“Mr. E” wrote:
I’ve tried calling SetThemeAttribute. I’ve tried changing the size of the overhang png from 1281x165 to 1280x138. None of it works. The overhang for the keyboard screen is still an ugly white-blue gradient.

Can anyone help me out here?

“RokuRobB” wrote:
You can replace the overhang for that specific screen by calling roAppManager.SetThemeAttribute(“OverhangSliceHD”, “background_image”) where background_image is simply an image with the same color as the desired keyboard screen background. Then when navigating to other screens, call SetThemeAttribute again to set the overhang back to the original value. You can do this for the SD case as well by setting the OverhangSliceSD apptheme attribute.
If you’re setting it in your main SetTheme() metadata, you should be good. Can you share details on the image and the code that’s setting it in the theme? I’ve run into issues on the grid screen where images saved from Photoshop with the “Convert to sRGB” option checked wouldn’t load in the grid. I don’t know if that applies here, but I suppose it’s possible the same could be true for the overhang on some screens.

I believe the sRGB thing is the problem. I’m currently at work, so have no way to test this, but the tool I’m using, GIMP, sets the color profile as sRGB by default.

I guess I could try downloading color profiles from Adobe or something.

I’ll update this when I get a chance to test this. Thanks for your help!

“TheEndless” wrote:

“Mr. E” wrote:
I’ve tried calling SetThemeAttribute. I’ve tried changing the size of the overhang png from 1281x165 to 1280x138. None of it works. The overhang for the keyboard screen is still an ugly white-blue gradient.

Can anyone help me out here?

“RokuRobB” wrote:
You can replace the overhang for that specific screen by calling roAppManager.SetThemeAttribute(“OverhangSliceHD”, “background_image”) where background_image is simply an image with the same color as the desired keyboard screen background. Then when navigating to other screens, call SetThemeAttribute again to set the overhang back to the original value. You can do this for the SD case as well by setting the OverhangSliceSD apptheme attribute.
If you’re setting it in your main SetTheme() metadata, you should be good. Can you share details on the image and the code that’s setting it in the theme? I’ve run into issues on the grid screen where images saved from Photoshop with the “Convert to sRGB” option checked wouldn’t load in the grid. I don’t know if that applies here, but I suppose it’s possible the same could be true for the overhang on some screens.

Hmm, trying various color profiles in GIMP didn’t seem to resolve my issues. Even recreating the image in InkScape(which worked for my logo artwork) didn’t seem to help.

Here’s my code in main.brs:

sub Main()
    ' Set the basic color scheme
    SetTheme()

    while true
        DoLogin()
    end while
end sub

sub SetTheme()
    app = CreateObject("roAppManager")
    theme = CreateObject("roAssociativeArray")

    theme.OverhangOffsetHD_X = "125"
    theme.OverhangOffsetHD_Y = "35"
    theme.OverhangSliceHD = "pkg:/images/hd/overhang.png"
    theme.GridScreenOverhangSliceHD = "pkg:/images/hd/overhang.png"
    theme.OverhangLogoHD = "pkg:/images/hd/overhang_logo.png"

    ' Some other color info for the theme is set here.

    app.SetTheme(theme)
end sub

and here’s DoLogin():

sub DoLogin()
	port = CreateObject("roMessagePort")
	screen = CreateObject("roKeyboardScreen")
	screen.SetMessagePort(port)
	screen.SetTitle("Account Login")
	screen.SetDisplayText("Please enter your Grooveshark username")
	screen.AddButton(1, "Next")
	screen.AddButton(2, "Back")
	screen.Show()

	while true
		msg = wait(0, screen.GetMessagePort())
		print "Message Received."
		print msg
		if type(msg) = "roKeyboardScreenEvent"
			if msg.isScreenClosed()
				return
			else if msg.isButtonPressed() then
				print "Event: "; msg.GetMessage(); " idx: "; msg.GetIndex()
				if msg.GetIndex() = 1
					user_login = screen.GetText()
					print "Login: ";user_login
					
				endif
			endif
		endif
	end while
end sub

Here’s the logo(which works): http://i.imgur.com/1SkX8.png

And the overhang(which doesn’t): http://i.imgur.com/tDMTp.png

“Mr. E” wrote:
I believe the sRGB thing is the problem. I’m currently at work, so have no way to test this, but the tool I’m using, GIMP, sets the color profile as sRGB by default.

I guess I could try downloading color profiles from Adobe or something.

I’ll update this when I get a chance to test this. Thanks for your help!

Other quotes…

Try setting an SD overhang as well. I’ve found that some screens won’t use the HD theme attributes if equivalent SD attributes aren’t also present (and vice versa). In my quick test just now, I was able to duplicate your results by omitting the OverhangSliceSD attribute.

That was it! Thanks for your assistance!

“TheEndless” wrote:
Try setting an SD overhang as well. I’ve found that some screens won’t use the HD theme attributes if equivalent SD attributes aren’t also present (and vice versa). In my quick test just now, I was able to duplicate your results by omitting the OverhangSliceSD attribute.