Skip to content

Commit

Permalink
add an optional spacer to a full grid in each row (need some feedback…
Browse files Browse the repository at this point in the history
… on this one.. I don't like it)
  • Loading branch information
ljunkie committed Mar 4, 2014
1 parent b504a64 commit fef568e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 6 deletions.
Binary file added Plex/images/black/grid-spacer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Plex/images/grid-spacer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions Plex/source/GridScreen.brs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ Function showGridScreen() As Integer
end for
end if

m.isDescriptionVisible = true
if RegRead("rf_grid_description_"+isType, "preferences", "enabled") <> "enabled" then
m.isDescriptionVisible = false
m.screen.SetDescriptionVisible(false)
end if
Debug("isType: " + tostr(isType))
Expand Down Expand Up @@ -229,6 +231,8 @@ Function gridHandleMessage(msg) As Boolean
if context <> invalid then item = context[index]

if item <> invalid then
' ignore spacers
if item <> invalid and tostr(item.key) = "_invalid_spacer_" then return true

' user entered a section - remeber the last section to focus when launching the channel again
vc = GetViewController()
Expand Down Expand Up @@ -278,6 +282,16 @@ Function gridHandleMessage(msg) As Boolean
item = m.contentArray[m.selectedRow][m.focusedIndex]
end if

' if the full grid spacer is enabled, check if we need to hid or show the description
if RegRead("rf_fullgrid_spacer", "preferences", "disabled") = "enabled" then
if item <> invalid and tostr(item.key) = "_invalid_spacer_" then
m.screen.SetDescriptionVisible(false)
return true
else if m.isDescriptionVisible = true then
m.screen.SetDescriptionVisible(true)
end if
end if

vc = GetViewController()
if vc.Home <> invalid AND m.screenid <> vc.Home.ScreenID then
if item <> invalid and tostr(item.type) = "photo" and tostr(item.nodename) <> "Directory" then
Expand Down Expand Up @@ -398,6 +412,9 @@ Function gridHandleMessage(msg) As Boolean

context = m.contentArray[m.selectedRow]
item = context[m.focusedIndex]

' ignore spacers
if item <> invalid and tostr(item.key) = "_invalid_spacer_" then return true

itype = item.contenttype
if itype = invalid then itype = item.type
Expand All @@ -424,6 +441,12 @@ Function gridHandleMessage(msg) As Boolean
Debug("--- Not showing prefs on ctype:" + tostr(item.contenttype) + " itype:" + tostr(item.type) )
end if
else if msg.isRemoteKeyPressed() then
context = m.contentArray[m.selectedRow]
item = context[m.focusedIndex]

' ignore spacers
if item <> invalid and item.key = "_invalid_spacer_" then return true

if msg.GetIndex() = 13 then
sec_metadata = getSectionType() ' sometimes we don't know the item is photo ( appClips )
'if tostr(sec_metadata.type) = "photo" and m.item <> invalid and m.item.contenttype <> "section" then
Expand Down Expand Up @@ -484,6 +507,19 @@ Sub gridOnDataLoaded(row As Integer, data As Object, startItem As Integer, count
end if
end if

' Add a spacer item between the 1st and last item - exclude the full gred header row
if RegRead("rf_fullgrid_spacer", "preferences", "disabled") = "enabled" then
if m.gridrowsize <> invalid and data.Count() = m.gridrowsize and m.isfullgrid = true and (NOT(m.loader.hasHeaderRow = true) or row > 0) then
imageDir = GetGlobalAA().Lookup("rf_theme_dir")
spacer = {}
spacer.title = ""
spacer.key = "_invalid_spacer_"
spacer.SDPosterURL = imageDir + "grid-spacer.png"
spacer.HDPosterURL = imageDir + "grid-spacer.png"
data[m.gridrowsize] = spacer
end if
end if

m.contentArray[row] = data

' Don't bother showing empty rows
Expand Down
4 changes: 2 additions & 2 deletions Plex/source/PaginatedDataLoader.brs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Function createPaginatedLoader(container, initialLoadSize, pageSize, item = inva
header_row = CreateObject("roAssociativeArray")
header_row.content = subsecItems
header_row.loadStatus = 0 ' 0:Not loaded, 1:Partially loaded, 2:Fully loaded
header_row.key = "_subsec_"
header_row.key = "_invalid_headerrow_"
header_row.name = firstof(item.title,"Sub Sections")
header_row.pendingRequests = 0
header_row.countLoaded = 0
Expand All @@ -180,7 +180,7 @@ Function createPaginatedLoader(container, initialLoadSize, pageSize, item = inva
for index = 0 to loader.contentArray.Count() - 1
status = loader.contentArray[index]
loader.names[index] = status.name
if status.key = "_search_" or status.key = "_subsec_" then
if status.key = "_search_" or status.key = "_invalid_headerrow_" then
status.key = invalid
end if
next
Expand Down
16 changes: 14 additions & 2 deletions Plex/source/PreferenceScreen.brs
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,17 @@ Function createSectionDisplayPrefsScreen(viewController) As Object
default: "disabled"
}

values = [
{ title: "Enabled", EnumValue: "enabled" },
{ title: "Disabled", EnumValue: "disabled" },

]
obj.Prefs["rf_fullgrid_spacer"] = {
values: values
heading: "Insert a blank poster between the first and last item in a row",
default: "disabled"
}

' Display Mode for Grid or Poster views
' { title: "Zoom", EnumValue: "zoom-to-fill", ShortDescriptionLine2: "zoom image to fill boundary" }, again, no one wants this
display_modes = [
Expand Down Expand Up @@ -2292,7 +2303,8 @@ Function createSectionDisplayPrefsScreen(viewController) As Object
obj.AddItem({title: "Grid Style/Size", ShortDescriptionLine2: "Size of Grid"}, "rf_grid_style", obj.GetEnumValue("rf_grid_style"))
obj.AddItem({title: "Grid Display Mode", ShortDescriptionLine2: "Stretch or Fit images to fill the focus box"}, "rf_grid_displaymode", obj.GetEnumValue("rf_grid_displaymode"))
obj.AddItem({title: "Grid Pop Out", ShortDescriptionLine2: "Description on bottom right"}, "rf_grid_description")
obj.AddItem({title: "Full Grid - hide text", ShortDescriptionLine2: "Hide text on top of each row"}, "rf_fullgrid_hidetext", obj.GetEnumValue("rf_fullgrid_hidetext"))
obj.AddItem({title: "Full Grid Hide Header", ShortDescriptionLine2: "Hide text on top of each row"}, "rf_fullgrid_hidetext", obj.GetEnumValue("rf_fullgrid_hidetext"))
obj.AddItem({title: "Full Grid Spacer", ShortDescriptionLine2: "Hide text on top of each row"}, "rf_fullgrid_spacer", obj.GetEnumValue("rf_fullgrid_spacer"))
'we can add this.. but it doesn't do much yet.. let's not totally confuse people.. yet.
'obj.AddItem({title: "Poster Display Mode", ShortDescriptionLine2: "Stretch or Fit images to fill the focus box"}, "rf_poster_displaymode", obj.GetEnumValue("rf_poster_displaymode"))
obj.AddItem({title: "Close"}, "close")
Expand All @@ -2310,7 +2322,7 @@ Function prefsSectionDisplayHandleMessage(msg) As Boolean
m.ViewController.PopScreen(m)
else if msg.isListItemSelected() then
command = m.GetSelectedCommand(msg.GetIndex())
if command = "use_grid_for_series" or command = "rf_poster_grid" or command = "rf_grid_style" or command = "rf_grid_displaymode" or command = "rf_poster_displaymode" or command = "rf_fullgrid_hidetext" or command = "rf_episode_episodic_style" or command = "section_sort" then
if command = "use_grid_for_series" or command = "rf_poster_grid" or command = "rf_grid_style" or command = "rf_grid_displaymode" or command = "rf_poster_displaymode" or command = "rf_fullgrid_hidetext" or command = "rf_episode_episodic_style" or command = "section_sort" or command = "rf_fullgrid_spacer" then
m.HandleEnumPreference(command, msg.GetIndex())
else if command = "rf_grid_description" then
screen = createGridDescriptionPrefsScreen(m.ViewController)
Expand Down
4 changes: 2 additions & 2 deletions Plex/source/rarflix_fullgrid.brs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Function createFULLgridPaginatedLoader(container, initialLoadSize, pageSize, ite
header_row = CreateObject("roAssociativeArray")
header_row.content = headerRow
header_row.loadStatus = 0 ' 0:Not loaded, 1:Partially loaded, 2:Fully loaded
header_row.key = "_subsec_"
header_row.key = "_invalid_headerrow_"
header_row.name = firstof(item.title,"Sub Sections")
header_row.pendingRequests = 0
header_row.countLoaded = 0
Expand All @@ -251,7 +251,7 @@ Function createFULLgridPaginatedLoader(container, initialLoadSize, pageSize, ite
for index = 0 to loader.contentArray.Count() - 1
status = loader.contentArray[index]
loader.names[index] = status.name
if status.key = "_search_" or status.key = "_subsec_" then
if status.key = "_search_" or status.key = "_invalid_headerrow_" then
status.key = invalid
end if
next
Expand Down

0 comments on commit fef568e

Please sign in to comment.