Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
out/
out/roku-deploy.zip
.history/
.vscode
2 changes: 1 addition & 1 deletion components/rowListContent.brs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sub init()
m.global.http.request = { payload: {
userId: 1,
title: "WOW, IT WORKED ^_^",
}, url: "https://jsonplaceholder.typicode.com/albums", requestType: "GET"}
}, url: "https://jsonplaceholder.typicode.com/albums", requestType: "GET" }
m.global.http.observeFieldScoped("response", "useResponse")
end sub

Expand Down
2 changes: 1 addition & 1 deletion components/rowListContent.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="RowListContent" extends="ContentNode">
<script type="text/brightscript" uri="pkg:/components/rowListContent.brs" />
<script type="text/brightscript" uri="pkg:/components/RowListContent.brs" />
<children></children>
</component>
2 changes: 1 addition & 1 deletion components/rowListItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field id="focusPercent" type="float" onChange="handleFocus" />
<field id="rowFocusPercent" type="float" onChange="handleRowFocus" />
</interface>
<script type="text/brightscript" uri="pkg:/components/rowListItem.brs" />
<script type="text/brightscript" uri="pkg:/components/RowListItem.brs" />
<children>
<Poster scaleRotateCenter="[ 160.0, 90.0 ]" id="itemPoster" width="320" height="180" translation="[0,20]">
<Rectangle id="itemMask" width="320" height="180" scaleRotateCenter="[ 256.0, 144.0 ]" color="0x101010FF" opacity="0.75" />
Expand Down
62 changes: 42 additions & 20 deletions components/rowListScene.brs
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
sub init()
m.global.addField("http", "node", FALSE)
m.global.addField("ratio", "float", FALSE)
m.global.http = createObject("roSGNode", "httpTask")
m.global.http.control = "RUN"
m.global.ratio = 1
m.rowList = m.top.findNode("mainRowList")
m.rowList.content = createObject("roSGNode", "RowListContent")
m.rowList.setFocus(true)
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
m.global.ratio = 0.66
initGetNodes()
m.btnGroup.setFocus(true)
initObservers()
end sub

sub initGetNodes()
m.btnGroup = m.top.findNode("btnGroup")
m.start = m.btnGroup.findNode("start")
m.stopTimer = m.btnGroup.findNode("stopTimer")
' m.timer = m.top.findNode("timer")
m.timeLabel = m.top.findNode("timeLabel")
end sub

sub initObservers()
m.start.observeField("buttonSelected", "start")
m.stopTimer.observeField("buttonSelected", "stopTimer")
m.timer = createObject("roTimespan")
' m.timer.observeField("fire", "changeText")
end sub

sub start()
m.timeLabel.text = "00:00"
m.timer.Mark()
end sub

sub stopTimer()
time = m.timer.TotalSeconds()
if time MOD 60 = 0
seconds = "00"
minutes = Str(time / 60)
else
minutes = Str(INT(time / 60))
seconds = Str(INT(time MOD 60))
end if
if m.global.ratio = 0.66
m.rowList.rowHeights = [Cdbl(m.rowList.rowHeights[0] * m.global.ratio) + 10]
m.rowList.rowItemSpacing = [[5, 0]]
m.rowList.focusXOffset = [Cdbl(m.rowList.focusXOffset[0] * m.global.ratio) - 50]
m.rowList.rowItemSize = [[INT(m.rowList.rowItemSize[0][0] * m.global.ratio) + 20, INT(m.rowList.rowItemSize[0][1] * m.global.ratio)]]
m.rowList.translation = [INT(m.rowList.translation[0] * m.global.ratio), INT(m.rowList.translation[1] / m.global.ratio) - 100]
m.rowList.rowLabelOffset = [[INT(m.rowList.rowLabelOffset[0][0] * m.global.ratio), INT(m.rowList.rowLabelOffset[0][1] * m.global.ratio) - 6]]
m.rowList.itemSize = [1400, INT(m.rowList.itemSize[1] * m.global.ratio)]
minutes = minutes.trim()
seconds = seconds.trim()
if Len(minutes) = 1
minutes = "0" + minutes
end if
end sub
if Len(seconds) = 1
seconds = "0" + seconds
end if
m.timeLabel.text = minutes + ":" + seconds
end sub
11 changes: 8 additions & 3 deletions components/rowListScene.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="rowListScene" extends="Scene" initialFocus="mainRowList">
<script type="text/brightscript" uri="rowListScene.brs" />
<component name="RowListScene" extends="Scene" initialFocus="mainRowList">
<script type="text/brightscript" uri="RowListScene.brs" />
<children>
<RowList id="mainRowList" rowSpacings="[0.0]" focusXOffset="[-150.0]" translation="[ 0, 330 ]" rowLabelOffset="[[220.0,-6.0]]" itemComponentName="RowListItem" numRows="2" itemSize="[ 1608, 250 ]" rowItemSize="[ [368, 250] ]" rowHeights="[250.0]" vertFocusAnimationStyle="fixedFocusWrap" rowFocusAnimationStyle="fixedFocusWrap" showRowLabel="[true]" rowItemSpacing="[[0.0,0.0]]" drawFocusFeedback="false" rowLabelFont="font:LargeBoldSystemFont" />
<!-- <Timer id="timer" duration="1000.00" /> -->
<Label translation="[300,300]" id="timeLabel" />
<ButtonGroup translation="[300,500]" id="btnGroup">
<Button text="start" id="start" />
<Button text="stop" id="stopTimer" />
</ButtonGroup>
</children>
</component>