diff --git a/components/ItemGrid/LoadItemsTask2.brs b/components/ItemGrid/LoadItemsTask2.brs index 25a6be09..faada9b2 100644 --- a/components/ItemGrid/LoadItemsTask2.brs +++ b/components/ItemGrid/LoadItemsTask2.brs @@ -187,12 +187,20 @@ sub loadItems() tmp = CreateObject("roSGNode", "MusicArtistData") else if item.Type = "Audio" tmp = CreateObject("roSGNode", "MusicSongData") + else if item.Type = "MusicGenre" + tmp = CreateObject("roSGNode", "FolderData") + tmp.title = item.name + tmp.parentFolder = m.top.itemId + tmp.json = item + tmp.type = "Folder" + tmp.posterUrl = api_API().items.getimageurl(item.id, "primary", 0, { "maxHeight": 280, "maxWidth": 280, "quality": "90" }) + else print "[LoadItems] Unknown Type: " item.Type end if if tmp <> invalid - if item.Type <> "Genre" + if item.Type <> "Genre" and item.Type <> "MusicGenre" tmp.parentFolder = m.top.itemId tmp.json = item if item.UserData <> invalid and item.UserData.isFavorite <> invalid diff --git a/components/ItemGrid/MusicArtistGridItem.brs b/components/ItemGrid/MusicArtistGridItem.brs new file mode 100644 index 00000000..438d7321 --- /dev/null +++ b/components/ItemGrid/MusicArtistGridItem.brs @@ -0,0 +1,48 @@ +sub init() + m.itemPoster = m.top.findNode("itemPoster") + m.posterText = m.top.findNode("posterText") + m.posterText.font.size = 30 + m.backdrop = m.top.findNode("backdrop") + + m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged") + + 'Parent is MarkupGrid and it's parent is the ItemGrid + m.topParent = m.top.GetParent().GetParent() + + 'Get the imageDisplayMode for these grid items + if m.topParent.imageDisplayMode <> invalid + m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode + end if + +end sub + +sub itemContentChanged() + m.backdrop.blendColor = "#101010" + + itemData = m.top.itemContent + + if not isValid(itemData) then return + + if LCase(itemData.type) = "musicalbum" + m.backdrop.uri = "pkg:/images/icons/album.png" + else if LCase(itemData.type) = "musicartist" + m.backdrop.uri = "pkg:/images/missingArtist.png" + else if LCase(itemData.json.type) = "musicgenre" + m.backdrop.uri = "pkg:/images/icons/musicFolder.png" + end if + + m.itemPoster.uri = itemData.PosterUrl + m.posterText.text = itemData.title + + 'If Poster not loaded, ensure "blue box" is shown until loaded + if m.itemPoster.loadStatus <> "ready" + m.backdrop.visible = true + end if +end sub + +'Hide backdrop and text when poster loaded +sub onPosterLoadStatusChanged() + if m.itemPoster.loadStatus = "ready" + m.backdrop.visible = false + end if +end sub diff --git a/components/ItemGrid/MusicArtistGridItem.xml b/components/ItemGrid/MusicArtistGridItem.xml new file mode 100644 index 00000000..5533d515 --- /dev/null +++ b/components/ItemGrid/MusicArtistGridItem.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + +