MarlonC
MarlonC

Reputation: 67

How to combine Scenegraph Developer Extensions (SGDEX)

The new Roku scenegraph developer extensions seem pretty useful. I have two SGDEX views that are useful to me. However I need to combine them and I do not see any documentation on how to do it.

The Custom+Scene example is what I am working off of. Simply I would add to add the searchView feature to this script.

I have tried adding SearchView as a component. However the searchview example is it's own working page, I would like to add it as a node. I have tried adding it as an overhang, and also tried adding it as a button on the homepage. I have been unsuccessful with both.

Please see scenegraph developer extensions.

I simply need to add the SearchView feature to the Custom+Scene example in SGDEX. Please provide example of how to do this if you are familiar. Thanks.

Upvotes: 1

Views: 543

Answers (1)

Roger Ramirez
Roger Ramirez

Reputation: 176

Updated

Looks like what we wanted to achieve is open the searchView from the mainscene of the custom+screen example.

I updated the feed.json file of the project and add a new object after the "series" object.

 ...
 ...
 "search": [
        {
            "id": "search",
            "title": "Search",
            "releaseDate": "2015-06-11",
            "shortDescription": "Will open search view.",
            "thumbnail": "http://level2creative.com/wp-content/uploads/2017/08/image-search-ss-1920-800x450.gif",
            "genres": [
                "search"
            ],
            "tags": [
                "search"
            ],
            "content": {
                "dateAdded": "2015-06-11T14:14:54.431Z",
                "captions": [],
                "videos": [
                    {
                        "url": "http://roku.content.video.llnw.net/smedia/59021fabe3b645968e382ac726cd6c7b/Gb/siCt-V7LOSU08W_Ve1ByJY5N9emKZeXZvnrH2Yb9c/117_segment_2_twitch__nw_060515.mp4",
                        "quality": "HD",
                        "videoType": "MP4"
                    }
                ],
                "duration": 53
            }
        }
    ]

On your GridHandler.brs, change the ParseJsonToNodeArray function, lets change the if condition of the line 27, so it will look like this:

if fieldInJsonAA = "movies" or fieldInJsonAA = "series" or fieldInJsonAA = "search"

Then, on your mainscene.brs, go to the method "OnGridItemSelected", change it for something like this:

rowContent = grid.content.GetChild(selectedIndex[0])
if rowContent.title = "search"
    searchView = CreateObject("roSGNode", "SearchView")
    searchView.hintText = "Search for something"
    m.top.ComponentController.CallFunc("show", {
        view: searchView
    })
else
    detailsView = ShowDetailsView(rowContent, selectedIndex[1])
    detailsView.ObserveField("wasClosed", "OnDetailsWasClosed")
end if

That should open the searchView and if you press back that should close the searchView and take the user back to the gridView.

Docs

Upvotes: 1

Related Questions