From 1fd97c9fb7c1fe6b34c1cf1f827de40a99774dac Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Tue, 28 Sep 2021 15:27:08 +0200
Subject: [PATCH 1/7] made animated scroll
---
components/rowListContent.brs | 13 +++++++---
components/rowListScene.brs | 48 ++++++++++++++++++++++++++++++++---
components/rowListScene.xml | 17 ++++++++++++-
3 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/components/rowListContent.brs b/components/rowListContent.brs
index a37fbf2..18ff5c6 100644
--- a/components/rowListContent.brs
+++ b/components/rowListContent.brs
@@ -2,10 +2,17 @@ sub init()
m.global.http.request = { payload: {
userId: 1,
title: "WOW, IT WORKED ^_^",
- }, url: "https://jsonplaceholder.typicode.com/albums", requestType: "GET"}
+ }, url: "https://alghool.net/RokuDev/data.json", requestType: "GET" }
m.global.http.observeFieldScoped("response", "useResponse")
end sub
sub useResponse()
- ?m.global.http.response
-end sub
+ itemNode = m.top.createChild("ContentNode")
+ itemNode.title = m.global.http.response.body[0].TITLE
+ for each itemData in m.global.http.response.body[0].data
+ itemDetails = itemNode.createChild("ContentNode")
+ itemDetails.title = itemData.title
+ itemDetails.HDPosterUrl = itemData.thumbnail
+ itemDetails.description = itemData.longDescription
+ end for
+end sub
\ No newline at end of file
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 22d7821..91aaa2d 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -4,9 +4,22 @@ sub init()
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)
+ m.rowList1 = m.top.findNode("rowList1")
+ m.rowList2 = m.top.findNode("rowList2")
+ m.rowList3 = m.top.findNode("rowList3")
+ m.rowList4 = m.top.findNode("rowList4")
+ m.rowList5 = m.top.findNode("rowList5")
+ m.rowList6 = m.top.findNode("rowList6")
+ m.parent = m.top.findNode("rowListParty")
+ m.scrollAnimation = m.top.findNode("scroll")
+ m.rowList1.content = createObject("roSGNode", "RowListContent")
+ m.rowList2.content = createObject("roSGNode", "RowListContent")
+ m.rowList3.content = createObject("roSGNode", "RowListContent")
+ m.rowList4.content = createObject("roSGNode", "RowListContent")
+ m.rowList5.content = createObject("roSGNode", "RowListContent")
+ m.rowList6.content = createObject("roSGNode", "RowListContent")
+ m.rowFocused = 0
+ m.rowList1.setFocus(true)
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
m.global.ratio = 0.66
@@ -21,3 +34,32 @@ sub init()
m.rowList.itemSize = [1400, INT(m.rowList.itemSize[1] * m.global.ratio)]
end if
end sub
+
+sub animateScroll(direction as String)
+ if direction = "down" and m.rowFocused < 5
+ m.rowFocused++
+ for i = 0 to 5
+ m.scrollAnimation.getChild(i).keyValue = [[0, m.parent.getChild(i).translation[1]], [0, m.parent.getChild(i).translation[1] - 300]]
+ end for
+ m.parent.getChild(m.rowFocused).setFocus(true)
+ m.scrollAnimation.control = "start"
+ else if direction = "up" and m.rowFocused > 0
+ for i = 0 to 5
+ m.scrollAnimation.getChild(i).keyValue = [[0, m.parent.getChild(i).translation[1]], [0, m.parent.getChild(i).translation[1] + 300]]
+ end for
+ m.parent.getChild(m.rowFocused).setFocus(true)
+ m.scrollAnimation.control = "start"
+ end if
+end sub
+
+function onKeyEvent(key as String, press as Boolean) as Boolean
+ if press
+ if key = "down"
+ animateScroll(key)
+ return true
+ else if key = "up"
+ animateScroll(key)
+ return true
+ end if
+ end if
+end function
\ No newline at end of file
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index bc7e6b9..c22316e 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -2,6 +2,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 52c7325c4e25b68b6478587c2efb6bc732026036 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Thu, 30 Sep 2021 09:29:55 +0200
Subject: [PATCH 2/7] traslation only to parent
---
components/rowListScene.brs | 7 +++----
components/rowListScene.xml | 7 +------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 91aaa2d..6c92647 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -39,14 +39,13 @@ sub animateScroll(direction as String)
if direction = "down" and m.rowFocused < 5
m.rowFocused++
for i = 0 to 5
- m.scrollAnimation.getChild(i).keyValue = [[0, m.parent.getChild(i).translation[1]], [0, m.parent.getChild(i).translation[1] - 300]]
+ m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
end for
m.parent.getChild(m.rowFocused).setFocus(true)
m.scrollAnimation.control = "start"
else if direction = "up" and m.rowFocused > 0
- for i = 0 to 5
- m.scrollAnimation.getChild(i).keyValue = [[0, m.parent.getChild(i).translation[1]], [0, m.parent.getChild(i).translation[1] + 300]]
- end for
+ m.rowFocused--
+ m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] + 300]]
m.parent.getChild(m.rowFocused).setFocus(true)
m.scrollAnimation.control = "start"
end if
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index c22316e..011510e 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -10,12 +10,7 @@
-
-
-
-
-
-
+
From 170e251037c30b265d4a694e3d683cea1583aa84 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Thu, 30 Sep 2021 11:21:42 +0200
Subject: [PATCH 3/7] handled scroll
---
components/rowListScene.brs | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 6c92647..0327eaa 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -4,22 +4,14 @@ sub init()
m.global.http = createObject("roSGNode", "httpTask")
m.global.http.control = "RUN"
m.global.ratio = 1
- m.rowList1 = m.top.findNode("rowList1")
- m.rowList2 = m.top.findNode("rowList2")
- m.rowList3 = m.top.findNode("rowList3")
- m.rowList4 = m.top.findNode("rowList4")
- m.rowList5 = m.top.findNode("rowList5")
- m.rowList6 = m.top.findNode("rowList6")
+ m.rows = m.top.getChild(1).getChildren(6, 0)
m.parent = m.top.findNode("rowListParty")
m.scrollAnimation = m.top.findNode("scroll")
- m.rowList1.content = createObject("roSGNode", "RowListContent")
- m.rowList2.content = createObject("roSGNode", "RowListContent")
- m.rowList3.content = createObject("roSGNode", "RowListContent")
- m.rowList4.content = createObject("roSGNode", "RowListContent")
- m.rowList5.content = createObject("roSGNode", "RowListContent")
- m.rowList6.content = createObject("roSGNode", "RowListContent")
+ for each row in m.rows
+ row.content = createObject("roSGNode", "RowListContent")
+ end for
m.rowFocused = 0
- m.rowList1.setFocus(true)
+ m.rows[0].setFocus(true)
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
m.global.ratio = 0.66
@@ -36,18 +28,23 @@ sub init()
end sub
sub animateScroll(direction as String)
- if direction = "down" and m.rowFocused < 5
+ if direction = "down" and m.rowFocused < 4 and m.scrollAnimation.state = "stopped"
m.rowFocused++
- for i = 0 to 5
- m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
- end for
+ m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
m.parent.getChild(m.rowFocused).setFocus(true)
m.scrollAnimation.control = "start"
- else if direction = "up" and m.rowFocused > 0
+ else if direction = "up" and m.rowFocused = 1 and m.scrollAnimation.state = "stopped"
+ m.parent.getChild(m.rowFocused - 1).setFocus(true)
+ else if direction = "up" and m.rowFocused > 1 and m.scrollAnimation.state = "stopped"
m.rowFocused--
m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] + 300]]
m.parent.getChild(m.rowFocused).setFocus(true)
m.scrollAnimation.control = "start"
+ else if direction = "down" and m.rowFocused = 4 and m.scrollAnimation.state = "stopped"
+ m.parent.getChild(m.rowFocused + 1).setFocus(true)
+ m.rowFocused = 5
+ else if direction = "up" and m.rowFocused = 5 and m.scrollAnimation.state = "stopped"
+ m.parent.getChild(m.rowFocused - 1).setFocus(true)
end if
end sub
From 7565b50ea69c9c978c5d0dd0f45813d11cd1afd3 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Fri, 8 Oct 2021 14:29:41 +0200
Subject: [PATCH 4/7] Done
---
.../components/rowListScene_20211008141935.xml | 17 +++++++++++++++++
.../components/rowListScene_20211008142233.xml | 17 +++++++++++++++++
.../components/rowListScene_20211008142249.xml | 17 +++++++++++++++++
.../components/rowListScene_20211008142332.xml | 17 +++++++++++++++++
.../components/rowListScene_20211008142828.xml | 17 +++++++++++++++++
.../components/rowListScene_20211008142829.xml | 17 +++++++++++++++++
components/rowListScene.xml | 12 ++++++------
7 files changed, 108 insertions(+), 6 deletions(-)
create mode 100644 .history/components/rowListScene_20211008141935.xml
create mode 100644 .history/components/rowListScene_20211008142233.xml
create mode 100644 .history/components/rowListScene_20211008142249.xml
create mode 100644 .history/components/rowListScene_20211008142332.xml
create mode 100644 .history/components/rowListScene_20211008142828.xml
create mode 100644 .history/components/rowListScene_20211008142829.xml
diff --git a/.history/components/rowListScene_20211008141935.xml b/.history/components/rowListScene_20211008141935.xml
new file mode 100644
index 0000000..011510e
--- /dev/null
+++ b/.history/components/rowListScene_20211008141935.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.history/components/rowListScene_20211008142233.xml b/.history/components/rowListScene_20211008142233.xml
new file mode 100644
index 0000000..786e1f5
--- /dev/null
+++ b/.history/components/rowListScene_20211008142233.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.history/components/rowListScene_20211008142249.xml b/.history/components/rowListScene_20211008142249.xml
new file mode 100644
index 0000000..8ae54ea
--- /dev/null
+++ b/.history/components/rowListScene_20211008142249.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.history/components/rowListScene_20211008142332.xml b/.history/components/rowListScene_20211008142332.xml
new file mode 100644
index 0000000..5e79952
--- /dev/null
+++ b/.history/components/rowListScene_20211008142332.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.history/components/rowListScene_20211008142828.xml b/.history/components/rowListScene_20211008142828.xml
new file mode 100644
index 0000000..79f9e44
--- /dev/null
+++ b/.history/components/rowListScene_20211008142828.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.history/components/rowListScene_20211008142829.xml b/.history/components/rowListScene_20211008142829.xml
new file mode 100644
index 0000000..9df7cf4
--- /dev/null
+++ b/.history/components/rowListScene_20211008142829.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index 011510e..9df7cf4 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -3,12 +3,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
From f4f6ee035751c1126191db0ef9dbd817901a2d81 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Sun, 17 Oct 2021 08:50:18 +0200
Subject: [PATCH 5/7] rebuilding animation
---
.gitignore | 2 ++
components/rowListScene.brs | 44 ++++++++++++++++++++-----------------
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/.gitignore b/.gitignore
index fa001aa..f86df33 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
out/
out/roku-deploy.zip
+.history/
+.vscode/
\ No newline at end of file
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 0327eaa..2fa2aaf 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -28,24 +28,31 @@ sub init()
end sub
sub animateScroll(direction as String)
- if direction = "down" and m.rowFocused < 4 and m.scrollAnimation.state = "stopped"
- m.rowFocused++
- m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
- m.parent.getChild(m.rowFocused).setFocus(true)
- m.scrollAnimation.control = "start"
- else if direction = "up" and m.rowFocused = 1 and m.scrollAnimation.state = "stopped"
- m.parent.getChild(m.rowFocused - 1).setFocus(true)
- else if direction = "up" and m.rowFocused > 1 and m.scrollAnimation.state = "stopped"
- m.rowFocused--
- m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] + 300]]
- m.parent.getChild(m.rowFocused).setFocus(true)
- m.scrollAnimation.control = "start"
- else if direction = "down" and m.rowFocused = 4 and m.scrollAnimation.state = "stopped"
- m.parent.getChild(m.rowFocused + 1).setFocus(true)
- m.rowFocused = 5
- else if direction = "up" and m.rowFocused = 5 and m.scrollAnimation.state = "stopped"
- m.parent.getChild(m.rowFocused - 1).setFocus(true)
+ ?m.rowFocused
+ if (direction = "down" and m.rowFocused = 5) or (m.rowFocused = 0 and m.direction = "up")
+ return false
+ else
+
end if
+ ' if direction = "down" and m.rowFocused < 4 and m.scrollAnimation.state = "stopped"
+ ' m.rowFocused++
+ ' m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
+ ' m.parent.getChild(m.rowFocused).setFocus(true)
+ ' m.scrollAnimation.control = "start"
+ ' else if direction = "up" and m.rowFocused = 1 and m.scrollAnimation.state = "stopped"
+ ' m.parent.getChild(m.rowFocused - 1).setFocus(true)
+ ' else if direction = "up" and m.rowFocused > 1 and m.scrollAnimation.state = "stopped"
+ ' m.rowFocused--
+ ' m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] + 300]]
+ ' m.parent.getChild(m.rowFocused).setFocus(true)
+ ' m.scrollAnimation.control = "start"
+ ' else if direction = "down" and m.rowFocused = 4 and m.scrollAnimation.state = "stopped"
+ ' m.parent.getChild(m.rowFocused + 1).setFocus(true)
+ ' m.rowFocused = 5
+ ' m.scrollAnimation.control = "start"
+ ' else if direction = "up" and m.rowFocused = 5 and m.scrollAnimation.state = "stopped"
+ ' m.parent.getChild(m.rowFocused - 1).setFocus(true)
+ ' end if
end sub
function onKeyEvent(key as String, press as Boolean) as Boolean
@@ -53,9 +60,6 @@ function onKeyEvent(key as String, press as Boolean) as Boolean
if key = "down"
animateScroll(key)
return true
- else if key = "up"
- animateScroll(key)
- return true
end if
end if
end function
\ No newline at end of file
From 7b3001ab6633c9299d7479faf8b429169c0e0d9a Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Sun, 17 Oct 2021 12:01:42 +0200
Subject: [PATCH 6/7] fixed animation
---
components/rowListScene.brs | 44 ++++++++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 2fa2aaf..573588c 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -11,6 +11,7 @@ sub init()
row.content = createObject("roSGNode", "RowListContent")
end for
m.rowFocused = 0
+ m.canScroll = true
m.rows[0].setFocus(true)
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
@@ -27,12 +28,44 @@ sub init()
end if
end sub
+sub animateUp()
+ m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] + 300]]
+ m.scrollAnimation.control = "start"
+end sub
+
+sub animateDown()
+ m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
+ m.scrollAnimation.control = "start"
+end sub
+
sub animateScroll(direction as String)
- ?m.rowFocused
- if (direction = "down" and m.rowFocused = 5) or (m.rowFocused = 0 and m.direction = "up")
- return false
+ if (direction = "down" and m.rowFocused = 3)
+ m.parent.getChild(m.rowFocused + 1).setFocus(true)
+ m.rowFocused++
+ else if (direction = "up" and m.rowFocused = 4)
+ m.parent.getChild(m.rowFocused - 1).setFocus(true)
+ m.rowFocused--
+ else if (direction = "down" and m.rowFocused > 4) or (m.rowFocused = 0 and direction = "up")
+ return
+ else if direction = "down" and m.scrollAnimation.state = "stopped" and m.rowFocused < 3 and m.canScroll = true
+ m.rowFocused++
+ animateDown()
+ m.parent.getChild(m.rowFocused).setFocus(true)
+ else if direction = "up" and m.rowFocused >= 4 or m.rowFocused <= 1 and m.scrollAnimation.state = "stopped"
+ animateUp()
+ m.parent.getChild(m.rowFocused - 1).setFocus(true)
+ m.rowFocused--
+ else if direction = "up" and m.rowFocused = 4
+ m.parent.getChild(m.rowFocused).setFocus(true)
+ else if direction = "up" and m.scrollAnimation.state = "stopped" and m.rowFocused >= 0
+ m.rowFocused--
+ m.parent.getChild(m.rowFocused).setFocus(true)
+ animateUp()
+ end if
+ if m.rowFocused >= 4
+ m.canScroll = false
else
-
+ m.canScroll = true
end if
' if direction = "down" and m.rowFocused < 4 and m.scrollAnimation.state = "stopped"
' m.rowFocused++
@@ -53,11 +86,12 @@ sub animateScroll(direction as String)
' else if direction = "up" and m.rowFocused = 5 and m.scrollAnimation.state = "stopped"
' m.parent.getChild(m.rowFocused - 1).setFocus(true)
' end if
+ ?m.rowFocused
end sub
function onKeyEvent(key as String, press as Boolean) as Boolean
if press
- if key = "down"
+ if key = "up" or key = "down"
animateScroll(key)
return true
end if
From ac41e8927bb89bb6ab649bd91998a4de1666ffc5 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Sun, 17 Oct 2021 12:03:30 +0200
Subject: [PATCH 7/7] removed logging and commenting
---
components/rowListScene.brs | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 573588c..ea2131b 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -67,26 +67,6 @@ sub animateScroll(direction as String)
else
m.canScroll = true
end if
- ' if direction = "down" and m.rowFocused < 4 and m.scrollAnimation.state = "stopped"
- ' m.rowFocused++
- ' m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] - 300]]
- ' m.parent.getChild(m.rowFocused).setFocus(true)
- ' m.scrollAnimation.control = "start"
- ' else if direction = "up" and m.rowFocused = 1 and m.scrollAnimation.state = "stopped"
- ' m.parent.getChild(m.rowFocused - 1).setFocus(true)
- ' else if direction = "up" and m.rowFocused > 1 and m.scrollAnimation.state = "stopped"
- ' m.rowFocused--
- ' m.scrollAnimation.getChild(0).keyValue = [[0, m.parent.translation[1]], [0, m.parent.translation[1] + 300]]
- ' m.parent.getChild(m.rowFocused).setFocus(true)
- ' m.scrollAnimation.control = "start"
- ' else if direction = "down" and m.rowFocused = 4 and m.scrollAnimation.state = "stopped"
- ' m.parent.getChild(m.rowFocused + 1).setFocus(true)
- ' m.rowFocused = 5
- ' m.scrollAnimation.control = "start"
- ' else if direction = "up" and m.rowFocused = 5 and m.scrollAnimation.state = "stopped"
- ' m.parent.getChild(m.rowFocused - 1).setFocus(true)
- ' end if
- ?m.rowFocused
end sub
function onKeyEvent(key as String, press as Boolean) as Boolean