This week I had a client with a navigation requirement that can be frustrating for a lot of Boxee developers. The application was for KidMango, an online video service chockful with excellent high quality children’s content like Care Bears, Where in the World is Carmen Sandiego? and Dennis the Menace. Their service categorizes their extensive library in four age groups, so a natural requirement of their Boxee app to provide users with the ability of using those groups as navigation options.
Kid-friendly navigation ftw!
One option would be to create entirely different windows for each age group for four xml files total. But this is not 1994 and we’re not using FrontPage; this option is entirely too unwieldy to maintain. We could leverage the API and use SetContentURL in an onclick event for each button, but some of these age groups have as many as 50 series in their RSS feeds. Navigating on Boxee systems with poor hardware would lead to a very jerky experience; we definitely need a loading dialog.
So, for this unique use case I came up with this approach for In-Window navigation. It satisfies our need to keep our code maintainable, while providing a strong experience for all hardware profiles. Consider the following code attached to a button control:
params = mc.Parameters()
params['title'] = "KidMango Kids"
params['link'] = "rss://apps.gonzee.tv/kidmango/series.php?channel=kids&pages=3"
Obviously assuming we’ve loaded the mc library already, what we’re doing here is giving each button two parameters – a title and a feed. We then reactivate the existing window to trigger the Progress Dialog and load our container with the new feed. Now we need to set up our list container to accept the data we send it:
<content type="url" url="App.Param(link)">
This method looks for the link parameter to connect the list container with a feed. But, with this approach, it means that the initial state of the app will be blank – no good for sure. We can solve this by attaching an onload event to the window that queues up the list container with the default feed:
params = mc.GetApp().GetLaunchedWindowParameters()
if (len(params) == 0):
And viola! Junk hardware friendly in-window navigation. For this tip in action, install the KidMango app available soon in the App Box.