diff --git a/components/ItemGrid/ItemGrid.bs b/components/ItemGrid/ItemGrid.bs index 16840b77..b67b2178 100644 --- a/components/ItemGrid/ItemGrid.bs +++ b/components/ItemGrid/ItemGrid.bs @@ -6,6 +6,7 @@ import "pkg:/source/roku_modules/log/LogMixin.brs" sub init() m.log = log.Logger("ItemGrid") + m.log.debug("start init()") m.options = m.top.findNode("options") m.showItemCount = m.global.session.user.settings["itemgrid.showItemCount"] @@ -70,6 +71,7 @@ sub init() m.resetGrid = m.global.session.user.settings["itemgrid.reset"] m.top.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"] + m.log.debug("end init()") end sub 'Genre Item Selected @@ -79,6 +81,7 @@ end sub 'Load initial set of Data sub loadInitialItems() + m.log.debug("start loadInitialItems()") m.loadItemsTask.control = "stop" startLoadingSpinner() @@ -227,6 +230,7 @@ sub loadInitialItems() startLoadingSpinner(false) m.loadItemsTask.control = "RUN" SetUpOptions() + m.log.debug("end loadInitialItems()") end sub ' Set Movies view, sort, and filter options @@ -438,6 +442,7 @@ end sub 'Handle loaded data, and add to Grid sub ItemDataLoaded(msg) + m.log.debug("start ItemDataLoaded()") itemData = msg.GetData() m.loadItemsTask.unobserveField("content") m.loadItemsTask.content = [] @@ -494,22 +499,28 @@ sub ItemDataLoaded(msg) end if stopLoadingSpinner() + m.log.debug("end ItemDataLoaded()") end sub 'Set Background Image sub SetBackground(backgroundUri as string) - + m.log.debug("start SetBackground()", backgroundUri, m.swapAnimation.state, m.newBackdrop.loadStatus) 'If a new image is being loaded, or transitioned to, store URL to load next - if m.swapAnimation.state <> "stopped" or m.newBackdrop.loadStatus = "loading" - m.queuedBGUri = backgroundUri - return + if not m.top.alphaActive + if m.swapAnimation.state <> "stopped" or m.newBackdrop.loadStatus = "loading" + m.log.debug("caching new background URI") + m.queuedBGUri = backgroundUri + return + end if end if m.newBackdrop.uri = backgroundUri + m.log.debug("end SetBackground()") end sub 'Handle new item being focused sub onItemFocused() + m.log.debug("start onItemFocused()", m.itemGrid.currFocusRow, m.itemGrid.itemFocused) focusedRow = m.itemGrid.currFocusRow @@ -518,7 +529,7 @@ sub onItemFocused() updateTitle() ' If no selected item, set background to parent backdrop - if itemInt = -1 + if itemInt = -1 or focusedRow = -1 return end if @@ -531,6 +542,7 @@ sub onItemFocused() if focusedRow >= m.loadedRows - 5 and m.loadeditems < m.loadItemsTask.totalRecordCount loadMoreData() end if + m.log.debug("end onItemFocused()") end sub 'When Image Loading Status changes @@ -551,6 +563,7 @@ sub swapDone() 'If there is another one to load if m.newBackdrop.uri <> m.queuedBGUri and m.queuedBGUri <> "" + m.log.debug("Loading queued backdrop image", m.queuedBGUri) SetBackground(m.queuedBGUri) m.queuedBGUri = "" end if @@ -559,6 +572,7 @@ end sub 'Load next set of items sub loadMoreData() + m.log.debug("start loadMoreData()") if m.Loading = true then return startLoadingSpinner(false) @@ -566,6 +580,7 @@ sub loadMoreData() m.loadItemsTask.startIndex = m.loadedItems m.loadItemsTask.observeField("content", "ItemDataLoaded") m.loadItemsTask.control = "RUN" + m.log.debug("end loadMoreData()") end sub 'Item Selected @@ -760,6 +775,20 @@ function getItemFocused() return invalid end function +sub alphaActiveChanged() + m.log.debug("start alphaActiveChanged()", m.top.alphaActive) + + if m.top.alphaActive + ' fade into an empty backdrop + m.swapAnimation.state = "stop" + m.queuedBGUri = "" + ' use a 1px image because we can't use the animation to fade into a blank uri string + SetBackground("pkg:/images/1px-262626.png") + end if + + m.log.debug("end alphaActiveChanged()") +end sub + function onKeyEvent(key as string, press as boolean) as boolean if not press then return false @@ -826,11 +855,14 @@ function onKeyEvent(key as string, press as boolean) as boolean return true end if else if key = "left" and topGrp.isinFocusChain() + m.log.debug("Now entering alpha menu") m.top.alphaActive = true topGrp.setFocus(false) m.alphaMenu.setFocus(true) + return true else if key = "right" and m.alpha.isinFocusChain() + m.log.debug("Now leaving alpha menu") m.top.alphaActive = false m.alphaMenu.setFocus(false) topGrp.setFocus(true) diff --git a/components/ItemGrid/ItemGrid.xml b/components/ItemGrid/ItemGrid.xml index bea6a14a..74b8665c 100644 --- a/components/ItemGrid/ItemGrid.xml +++ b/components/ItemGrid/ItemGrid.xml @@ -33,7 +33,7 @@ - + diff --git a/images/1px-262626.png b/images/1px-262626.png new file mode 100644 index 00000000..5122799a Binary files /dev/null and b/images/1px-262626.png differ