From 60cb640e8e8213386194167ce712857e57d4a7b7 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Wed, 22 Sep 2021 14:20:47 +0200
Subject: [PATCH 1/7] Made the interface to exchange information from item to
hero
---
components/rowListContent.brs | 19 +++++++++---
components/rowListItem.brs | 10 +++++++
components/rowListScene.brs | 14 +++++++++
components/rowListScene.xml | 55 ++++++++++++++++++++++++++++++++++-
4 files changed, 93 insertions(+), 5 deletions(-)
diff --git a/components/rowListContent.brs b/components/rowListContent.brs
index a37fbf2..2645a4d 100644
--- a/components/rowListContent.brs
+++ b/components/rowListContent.brs
@@ -2,10 +2,21 @@ sub init()
m.global.http.request = { payload: {
userId: 1,
title: "WOW, IT WORKED ^_^",
- }, url: "https://jsonplaceholder.typicode.com/albums", requestType: "GET"}
- m.global.http.observeFieldScoped("response", "useResponse")
+ }, url: "https://alghool.net/RokuDev/data.json", requestType: "GET"}
+ m.global.http.observeFieldScoped("response", "populateRowList")
end sub
-sub useResponse()
- ?m.global.http.response
+sub populateRowList()
+ items = m.global.http.response.body
+ for each item in items
+ itemNode = m.top.createChild("ContentNode")
+ itemNode.title = item.title
+ for each data in item.data
+ itemData = itemNode.createChild("ContentNode")
+ itemData.title = data.title
+ itemData.HDPosterUrl = data.thumbnail
+ itemData.description = data.longDescription
+ end for
+ m.top.appendChild(itemNode)
+ end for
end sub
diff --git a/components/rowListItem.brs b/components/rowListItem.brs
index 227b724..7713bf8 100644
--- a/components/rowListItem.brs
+++ b/components/rowListItem.brs
@@ -3,6 +3,7 @@ sub init()
m.itemTitle = m.top.findNode("itemTitle")
m.itemMask = m.top.findNode("itemMask")
m.itemDescription = m.top.findNode("itemDescription")
+ m.parentComponent = m.top.findNode("rowListScene")
end sub
sub showContent()
@@ -26,6 +27,15 @@ end sub
sub handleFocus()
scale = 1 + (m.top.focusPercent * 0.15)
m.itemPoster.scale = [scale, scale]
+ if m.top.focusPercent = 1
+ m.global.mainScreen.backgroundURI = m.itemPoster.uri
+ m.global.mainScreen.HeroDetails = {
+ MainBoldLabel:m.itemTitle.text
+ DateAndDurationLabel:"21 Sep 21 | 3m"
+ DescriptionLabel:m.itemDescription.text
+ CategoryLabel:"World"
+ }
+ end if
end sub
sub handleRowFocus()
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 22d7821..3326d9b 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -1,12 +1,19 @@
sub init()
m.global.addField("http", "node", FALSE)
m.global.addField("ratio", "float", FALSE)
+ m.global.addField("mainScreen", "node", FALSE)
+ m.global.mainScreen = m.top
m.global.http = createObject("roSGNode", "httpTask")
m.global.http.control = "RUN"
m.global.ratio = 1
m.rowList = m.top.findNode("mainRowList")
+ m.MainBoldLabel = m.top.findNode("MainBoldLabel")
+ m.DateAndDurationLabel = m.top.findNode("DateAndDurationLabel")
+ m.DescriptionLabel = m.top.findNode("DescriptionLabel")
+ m.CategoryLabel = m.top.findNode("CategoryLabel")
m.rowList.content = createObject("roSGNode", "RowListContent")
m.rowList.setFocus(true)
+ m.top.observeField("HeroDetails","handleHeroDetails")
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
m.global.ratio = 0.66
@@ -21,3 +28,10 @@ sub init()
m.rowList.itemSize = [1400, INT(m.rowList.itemSize[1] * m.global.ratio)]
end if
end sub
+
+sub handleHeroDetails()
+ m.MainBoldLabel.text = m.top.HeroDetails.MainBoldLabel
+ m.DateAndDurationLabel.text = m.top.HeroDetails.DateAndDurationLabel
+ m.DescriptionLabel.text = m.top.HeroDetails.DescriptionLabel
+ m.CategoryLabel.text = m.top.HeroDetails.CategoryLabel
+end sub
\ No newline at end of file
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index bc7e6b9..f3ff697 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -1,7 +1,60 @@
+
+
+
-
+
+
+
+
+
+
+
+
\ No newline at end of file
From fb2afc807ad4c235acd60ee9bbccd662b0961ae6 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Wed, 22 Sep 2021 17:02:23 +0200
Subject: [PATCH 2/7] removed .vscode folder
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index fa001aa..b74381e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
out/
out/roku-deploy.zip
+.vscode/
\ No newline at end of file
From 8e4e16741dd59f7fccd5fee05889403d5f24a81e Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Wed, 22 Sep 2021 17:02:31 +0200
Subject: [PATCH 3/7] removed .vscode folder
---
.vscode/launch.json | 19 -------------------
1 file changed, 19 deletions(-)
delete mode 100644 .vscode/launch.json
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index dca2ab3..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "type": "brightscript",
- "request": "launch",
- "name": "BrightScript Debug: Launch",
- "stopOnEntry": false,
- "host": "${promptForHost}",
- "password": "mega",
- "rootDir": "${workspaceFolder}",
- "enableDebuggerAutoRecovery": false,
- "stopDebuggerOnAppExit": false
- }
- ]
-}
\ No newline at end of file
From 968d8a362db7fd07f452fa0c328cc89d65d24b55 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Thu, 23 Sep 2021 09:17:01 +0200
Subject: [PATCH 4/7] Added basic animations in the design provided by Mr.
Hossam
---
components/rowListScene.brs | 3 ++
components/rowListScene.xml | 88 +++++++++++++++++++++++--------------
2 files changed, 59 insertions(+), 32 deletions(-)
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 3326d9b..090c436 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -11,6 +11,8 @@ sub init()
m.DateAndDurationLabel = m.top.findNode("DateAndDurationLabel")
m.DescriptionLabel = m.top.findNode("DescriptionLabel")
m.CategoryLabel = m.top.findNode("CategoryLabel")
+ m.textAnimation = m.top.findNode("heroDetailsAnimation")
+ ' m.overlayAnimation = m.top.findNode("mainOverlayAnimation")
m.rowList.content = createObject("roSGNode", "RowListContent")
m.rowList.setFocus(true)
m.top.observeField("HeroDetails","handleHeroDetails")
@@ -34,4 +36,5 @@ sub handleHeroDetails()
m.DateAndDurationLabel.text = m.top.HeroDetails.DateAndDurationLabel
m.DescriptionLabel.text = m.top.HeroDetails.DescriptionLabel
m.CategoryLabel.text = m.top.HeroDetails.CategoryLabel
+ m.textAnimation.control = "start"
end sub
\ No newline at end of file
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index f3ff697..6537c27 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -5,40 +5,64 @@
+
+
-
-
-
-
-
+ id="heroDetailsId"
+ translation = "[50,0]"
+ opacity="0.0" >
+
+
+
+
+
+
+
+
+
+
Date: Thu, 23 Sep 2021 11:45:26 +0200
Subject: [PATCH 5/7] replaced the global node with getScene()
---
components/rowListContent.brs | 11 ++---
components/rowListItem.brs | 16 +++----
components/rowListScene.brs | 11 +++--
components/rowListScene.xml | 85 +++++------------------------------
4 files changed, 31 insertions(+), 92 deletions(-)
diff --git a/components/rowListContent.brs b/components/rowListContent.brs
index 2645a4d..4111713 100644
--- a/components/rowListContent.brs
+++ b/components/rowListContent.brs
@@ -7,15 +7,16 @@ sub init()
end sub
sub populateRowList()
- items = m.global.http.response.body
- for each item in items
+ for each item in m.global.http.response.body
itemNode = m.top.createChild("ContentNode")
itemNode.title = item.title
for each data in item.data
itemData = itemNode.createChild("ContentNode")
- itemData.title = data.title
- itemData.HDPosterUrl = data.thumbnail
- itemData.description = data.longDescription
+ itemData.setFields({
+ title: data.title
+ HDPosterURL: data.thumbnail
+ description: data.longDescription
+ })
end for
m.top.appendChild(itemNode)
end for
diff --git a/components/rowListItem.brs b/components/rowListItem.brs
index 7713bf8..3fc140d 100644
--- a/components/rowListItem.brs
+++ b/components/rowListItem.brs
@@ -3,7 +3,7 @@ sub init()
m.itemTitle = m.top.findNode("itemTitle")
m.itemMask = m.top.findNode("itemMask")
m.itemDescription = m.top.findNode("itemDescription")
- m.parentComponent = m.top.findNode("rowListScene")
+ m.parentComponent = m.top.getScene()
end sub
sub showContent()
@@ -28,13 +28,13 @@ sub handleFocus()
scale = 1 + (m.top.focusPercent * 0.15)
m.itemPoster.scale = [scale, scale]
if m.top.focusPercent = 1
- m.global.mainScreen.backgroundURI = m.itemPoster.uri
- m.global.mainScreen.HeroDetails = {
- MainBoldLabel:m.itemTitle.text
- DateAndDurationLabel:"21 Sep 21 | 3m"
- DescriptionLabel:m.itemDescription.text
- CategoryLabel:"World"
- }
+ m.parentComponent.backgroundURI = m.itemPoster.uri
+ m.parentComponent.HeroDetails = {
+ MainBoldLabel: m.itemTitle.text
+ DateAndDurationLabel: "21 Sep 21 | 3m"
+ DescriptionLabel: m.itemDescription.text
+ CategoryLabel: "World"
+ }
end if
end sub
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 090c436..2c7e3b5 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -1,8 +1,6 @@
sub init()
m.global.addField("http", "node", FALSE)
m.global.addField("ratio", "float", FALSE)
- m.global.addField("mainScreen", "node", FALSE)
- m.global.mainScreen = m.top
m.global.http = createObject("roSGNode", "httpTask")
m.global.http.control = "RUN"
m.global.ratio = 1
@@ -11,11 +9,12 @@ sub init()
m.DateAndDurationLabel = m.top.findNode("DateAndDurationLabel")
m.DescriptionLabel = m.top.findNode("DescriptionLabel")
m.CategoryLabel = m.top.findNode("CategoryLabel")
- m.textAnimation = m.top.findNode("heroDetailsAnimation")
- ' m.overlayAnimation = m.top.findNode("mainOverlayAnimation")
+ m.fadeInAnimation = m.top.findNode("fadeInAnimation")
+ m.overlayAnimation = m.top.findNode("mainOverlayAnimation")
m.rowList.content = createObject("roSGNode", "RowListContent")
m.rowList.setFocus(true)
- m.top.observeField("HeroDetails","handleHeroDetails")
+ m.rowList.findNode("RowListItem")
+ m.top.observeField("HeroDetails", "handleHeroDetails")
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
m.global.ratio = 0.66
@@ -36,5 +35,5 @@ sub handleHeroDetails()
m.DateAndDurationLabel.text = m.top.HeroDetails.DateAndDurationLabel
m.DescriptionLabel.text = m.top.HeroDetails.DescriptionLabel
m.CategoryLabel.text = m.top.HeroDetails.CategoryLabel
- m.textAnimation.control = "start"
+ m.fadeInAnimation.control = "start"
end sub
\ No newline at end of file
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index 6537c27..0db143e 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -5,80 +5,19 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file
From 5ff064b4dd0076358dfed05e91ca001518cb8119 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Fri, 24 Sep 2021 14:07:54 +0200
Subject: [PATCH 6/7] Mr. Mostafa Changed applied
---
components/rowListContent.brs | 10 ++++++----
components/rowListItem.brs | 1 +
components/rowListScene.brs | 29 ++++++++++++++++++++++++-----
components/rowListScene.xml | 6 +++++-
4 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/components/rowListContent.brs b/components/rowListContent.brs
index 4111713..b2109bc 100644
--- a/components/rowListContent.brs
+++ b/components/rowListContent.brs
@@ -1,13 +1,15 @@
sub init()
- m.global.http.request = { payload: {
+ m.http = createObject("roSGNode", "httpTask")
+ m.http.request = { payload: {
userId: 1,
title: "WOW, IT WORKED ^_^",
- }, url: "https://alghool.net/RokuDev/data.json", requestType: "GET"}
- m.global.http.observeFieldScoped("response", "populateRowList")
+ }, url: "https://alghool.net/RokuDev/data.json", requestType: "GET" }
+ m.http.control = "RUN"
+ m.http.observeFieldScoped("response", "populateRowList")
end sub
sub populateRowList()
- for each item in m.global.http.response.body
+ for each item in m.http.response.body
itemNode = m.top.createChild("ContentNode")
itemNode.title = item.title
for each data in item.data
diff --git a/components/rowListItem.brs b/components/rowListItem.brs
index 3fc140d..d69ae6b 100644
--- a/components/rowListItem.brs
+++ b/components/rowListItem.brs
@@ -34,6 +34,7 @@ sub handleFocus()
DateAndDurationLabel: "21 Sep 21 | 3m"
DescriptionLabel: m.itemDescription.text
CategoryLabel: "World"
+ focus: m.itemPoster.uri
}
end if
end sub
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index 2c7e3b5..ed46ec3 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -1,20 +1,20 @@
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.flag = true
m.global.ratio = 1
m.rowList = m.top.findNode("mainRowList")
+ m.currFocus = invalid
m.MainBoldLabel = m.top.findNode("MainBoldLabel")
m.DateAndDurationLabel = m.top.findNode("DateAndDurationLabel")
m.DescriptionLabel = m.top.findNode("DescriptionLabel")
m.CategoryLabel = m.top.findNode("CategoryLabel")
m.fadeInAnimation = m.top.findNode("fadeInAnimation")
- m.overlayAnimation = m.top.findNode("mainOverlayAnimation")
+ m.fadeOutAnimation = m.top.findNode("fadeOutAnimation")
m.rowList.content = createObject("roSGNode", "RowListContent")
m.rowList.setFocus(true)
m.rowList.findNode("RowListItem")
m.top.observeField("HeroDetails", "handleHeroDetails")
+ m.fadeOutAnimation.observeField("state", "handleAnimationDone")
videoMode = createObject("roDeviceInfo")
if videoMode.GetVideoMode() = "720p"
m.global.ratio = 0.66
@@ -31,9 +31,28 @@ sub init()
end sub
sub handleHeroDetails()
+ if m.flag
+ m.flag = false
+ handleUpdate()
+ else
+ handleItemFocusChange()
+ end if
+end sub
+
+sub handleAnimationDone()
+ if m.fadeOutAnimation.state = "stopped"
+ handleUpdate()
+ m.fadeInAnimation.control = "start"
+ end if
+end sub
+
+sub handleItemFocusChange()
+ m.fadeOutAnimation.control = "start"
+end sub
+
+sub handleUpdate()
m.MainBoldLabel.text = m.top.HeroDetails.MainBoldLabel
m.DateAndDurationLabel.text = m.top.HeroDetails.DateAndDurationLabel
m.DescriptionLabel.text = m.top.HeroDetails.DescriptionLabel
m.CategoryLabel.text = m.top.HeroDetails.CategoryLabel
- m.fadeInAnimation.control = "start"
end sub
\ No newline at end of file
diff --git a/components/rowListScene.xml b/components/rowListScene.xml
index 0db143e..15be50a 100644
--- a/components/rowListScene.xml
+++ b/components/rowListScene.xml
@@ -13,9 +13,13 @@
-
+
+
+
+
+
From af623fc81333b0282b3d96debf4d0332c1f38e73 Mon Sep 17 00:00:00 2001
From: vampirekiddo <33176106+vampirekiddo@users.noreply.github.com>
Date: Mon, 27 Sep 2021 11:30:24 +0200
Subject: [PATCH 7/7] used events in fadeOutAnimationObserver
---
components/rowListScene.brs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/rowListScene.brs b/components/rowListScene.brs
index ed46ec3..d3baadd 100644
--- a/components/rowListScene.brs
+++ b/components/rowListScene.brs
@@ -39,8 +39,8 @@ sub handleHeroDetails()
end if
end sub
-sub handleAnimationDone()
- if m.fadeOutAnimation.state = "stopped"
+sub handleAnimationDone(event)
+ if event.getData() = "stopped"
handleUpdate()
m.fadeInAnimation.control = "start"
end if