Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mr__E
Channel Surfer

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!
0 Kudos
10 REPLIES 10
RokuRobB
Streaming Star

Re: JSON and roKeyboardScreen

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?
0 Kudos
Mr__E
Channel Surfer

Re: JSON and roKeyboardScreen

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?
0 Kudos
RokuRobB
Streaming Star

Re: JSON and roKeyboardScreen

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.
0 Kudos
Mr__E
Channel Surfer

Re: JSON and roKeyboardScreen

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...
0 Kudos
Mr__E
Channel Surfer

Re: JSON and roKeyboardScreen

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.
0 Kudos
TheEndless
Channel Surfer

Re: JSON and roKeyboardScreen

"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.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Mr__E
Channel Surfer

Re: JSON and roKeyboardScreen

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.
0 Kudos
Mr__E
Channel Surfer

Re: JSON and roKeyboardScreen

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....
0 Kudos
TheEndless
Channel Surfer

Re: JSON and roKeyboardScreen

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.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.