Merge pull request #1539 from cewert/update-alpha-menu

This commit is contained in:
Charles Ewert 2024-07-12 14:40:28 -04:00 committed by GitHub
commit 77dd380458
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 189 additions and 132 deletions

View File

@ -1,40 +1,43 @@
sub init()
m.top.visible = true
m.Alphamenu = m.top.findNode("Alphamenu")
m.Alphamenu.focusable = true
m.Alphatext = m.top.findNode("alphatext")
m.focusedChild = m.top.findNode("focusedChild")
m.Alphamenu.focusedFont.size = 25
m.Alphamenu.font.size = 25
m.top.setFocus(false)
m.alphaText = m.top.findNode("alphaText")
m.alphaMenu = m.top.findNode("alphaMenu")
m.alphaMenu.setFocus(false)
m.alphaMenu.focusedFont.size = 25
m.alphaMenu.font.size = 25
' show mic icon above alpha menu if remote supports voice commands
if m.global.device.hasVoiceRemote
alphaMic = m.top.findNode("alphaMic")
alphaMic.visible = true
micText = m.top.findNode("alphaMicText")
micText.font.size = 22
end if
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
if not m.alphaMenu.isInFocusChain() then return false
if key = "OK"
child = m.Alphatext.getChild(m.Alphamenu.itemFocused)
if child.title = m.top.itemAlphaSelected
m.top.itemAlphaSelected = ""
m.Alphamenu.focusFootprintBitmapUri = ""
else
m.Alphamenu.focusFootprintBitmapUri = "pkg:/images/white.png"
m.top.itemAlphaSelected = child.title
end if
child = m.alphaText.getChild(m.alphaMenu.itemFocused)
m.top.letterSelected = child.title
return true
end if
if key = "up"
if m.Alphamenu.itemFocused = 0
m.Alphamenu.jumpToItem = m.Alphamenu.numRows - 1
if m.alphaMenu.itemFocused = 0
m.alphaMenu.jumpToItem = m.alphaMenu.numRows - 1
return true
end if
end if
if key = "down"
if m.Alphamenu.itemFocused = m.Alphamenu.numRows - 1
m.Alphamenu.jumpToItem = 0
if m.alphaMenu.itemFocused = m.alphaMenu.numRows - 1
m.alphaMenu.jumpToItem = 0
return true
end if
end if

View File

@ -1,21 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="Alpha" extends="Group">
<children>
<Label id="alphaMicText" font="font:SmallSystemFont" translation="[1600,130]" text="Search" />
<Poster id="alphaMic" height="22" width="15" uri="pkg:/images/icons/mic_icon.png" translation="[1578, 130]" visible="false" />
<LabelList
translation="[50, 185]"
id="alphaMenu"
translation="[52, 206]"
vertFocusAnimationStyle="floatingFocus"
drawFocusFeedback="true"
id="Alphamenu"
font="font:SmallestSystemFont"
focusedFont="font:SmallestSystemFont"
itemSpacing="[0,2]"
itemSize="[28,28]"
numRows="27"
textHorizAlign="center"
drawFocusFeedback="true"
focusBitmapUri="pkg:/images/white.png"
focusBitmapBlendColor="#FFFFFF"
focusFootprintBlendColor="#666666"
>
<ContentNode id="alphatext" role="content">
<ContentNode id="alphaText" role="content">
<ContentNode title="#" />
<ContentNode title="A" />
<ContentNode title="B" />
@ -47,7 +50,6 @@
</LabelList>
</children>
<interface>
<field id="selectedItem" type="node" alwaysNotify="true" />
<field id="itemAlphaSelected" type="string" />
<field id="letterSelected" type="string" alwaysNotify="true" />
</interface>
</component>

View File

@ -36,7 +36,6 @@ sub init()
m.itemGrid.observeField("itemFocused", "onItemFocused")
m.itemGrid.observeField("itemSelected", "onItemSelected")
m.itemGrid.observeField("alphaSelected", "onItemalphaSelected")
'Voice filter setup
m.voiceBox = m.top.findNode("voiceBox")
@ -64,19 +63,11 @@ sub init()
'set inital counts for overhang before content is loaded.
m.loadItemsTask.totalRecordCount = 0
m.Alpha = m.top.findNode("AlphaMenu")
m.AlphaSelected = m.top.findNode("AlphaSelected")
m.alpha = m.top.findNode("alpha")
m.alphaMenu = m.alpha.findNode("alphaMenu")
'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]
m.micButton = m.top.findNode("micButton")
m.micButtonText = m.top.findNode("micButtonText")
'Hide voice search if device does not have voice remote
if m.global.device.hasVoiceRemote = false
m.micButton.visible = false
m.micButtonText.visible = false
end if
end sub
'
@ -103,14 +94,6 @@ sub loadInitialItems()
if m.top.parentItem.collectionType = "livetv"
' Translate between app and server nomenclature
viewSetting = m.global.session.user.settings["display.livetv.landing"]
'Move mic to be visiable on TV Guide screen
if m.global.device.hasVoiceRemote = true
m.micButton.translation = "[1540, 92]"
m.micButtonText.visible = true
m.micButtonText.translation = "[1600,130]"
m.micButtonText.font.size = 22
m.micButtonText.text = tr("Search")
end if
if viewSetting = "guide"
m.view = "tvGuide"
else
@ -163,9 +146,15 @@ sub loadInitialItems()
else
m.loadItemsTask.itemId = m.top.parentItem.Id
end if
' if we already searched for this alpha text than reset filter
if m.loadItemsTask.nameStartsWith = m.top.alphaSelected
m.loadItemsTask.nameStartsWith = ""
else
m.loadItemsTask.nameStartsWith = m.alpha.letterSelected
end if
updateTitle()
m.loadItemsTask.nameStartsWith = m.top.alphaSelected
m.loadItemsTask.searchTerm = m.voiceBox.text
m.emptyText.visible = false
m.loadItemsTask.sortField = m.sortField
@ -447,18 +436,16 @@ sub SetUpOptions()
m.options.options = options
end sub
'
'Handle loaded data, and add to Grid
sub ItemDataLoaded(msg)
stopLoadingSpinner()
m.top.alphaActive = false
itemData = msg.GetData()
m.loadItemsTask.unobserveField("content")
m.loadItemsTask.content = []
if itemData = invalid
m.Loading = false
stopLoadingSpinner()
return
end if
@ -485,9 +472,18 @@ sub ItemDataLoaded(msg)
m.data.appendChild(item)
end for
' keep focus on alpha menu when loading new data
if m.top.alphaActive
m.alphaMenu.setFocus(true)
else
m.itemGrid.opacity = "1"
m.genreList.opacity = "0"
m.alphaMenu.setFocus(false)
m.itemGrid.setFocus(true)
m.genreList.setFocus(false)
end if
'Update the stored counts
m.loadedItems = m.itemGrid.content.getChildCount()
m.loadedRows = m.loadedItems / m.itemGrid.numColumns
@ -498,8 +494,6 @@ sub ItemDataLoaded(msg)
m.emptyText.visible = true
end if
m.itemGrid.setFocus(true)
m.genreList.setFocus(false)
stopLoadingSpinner()
end sub
@ -588,7 +582,7 @@ sub onItemSelected()
m.top.selectedItem = m.itemGrid.content.getChild(m.itemGrid.itemSelected)
end sub
sub onItemalphaSelected()
sub alphaSelectedChanged()
if m.top.alphaSelected <> ""
m.loadedRows = 0
m.loadedItems = 0
@ -596,8 +590,7 @@ sub onItemalphaSelected()
m.itemGrid.content = m.data
m.loadItemsTask.searchTerm = ""
m.VoiceBox.text = ""
m.loadItemsTask.nameStartsWith = m.alpha.itemAlphaSelected
startLoadingSpinner(false)
loadInitialItems()
end if
end sub
@ -612,7 +605,24 @@ sub onvoiceFilter()
m.loadItemsTask.NameStartsWith = " "
m.loadItemsTask.searchTerm = m.voiceBox.text
m.loadItemsTask.recursive = true
startLoadingSpinner(false)
if m.voiceBox.text.len() = 1
' move focus to the letter spoken
alphaMenu = m.top.findNode("alphaMenu")
intConversion = m.voiceBox.text.ToInt() ' non numeric input returns as 0
if m.voiceBox.text = "0" or (isValid(intConversion) and intConversion <> 0)
alphaMenu.jumpToItem = 0
else
' loop through each option until we find a match
for i = 1 to alphaMenu.numRows - 1
alphaMenuOption = alphaMenu.content.getChild(i)
if Lcase(alphaMenuOption.TITLE) = Lcase(m.voiceBox.text)
alphaMenu.jumpToItem = i
exit for
end if
end for
end if
end if
loadInitialItems()
end if
end sub
@ -755,7 +765,7 @@ function getItemFocused()
return m.itemGrid.content.getChild(m.itemGrid.itemFocused)
else if m.genreList.isinFocusChain() and isValid(m.genreList.rowItemFocused)
return m.genreList.content.getChild(m.genreList.rowItemFocused[0]).getChild(m.genreList.rowItemFocused[1])
else if m.scheduleGrid.isinFocusChain() and isValid(m.scheduleGrid.itemFocused)
else if isValid(m.scheduleGrid) and m.scheduleGrid.isinFocusChain() and isValid(m.scheduleGrid.itemFocused)
return m.scheduleGrid.content.getChild(m.scheduleGrid.itemFocused)
end if
return invalid
@ -829,14 +839,11 @@ function onKeyEvent(key as string, press as boolean) as boolean
else if key = "left" and topGrp.isinFocusChain()
m.top.alphaActive = true
topGrp.setFocus(false)
alpha = m.alpha.getChild(0).findNode("Alphamenu")
alpha.setFocus(true)
m.alphaMenu.setFocus(true)
return true
else if key = "right" and m.Alpha.isinFocusChain()
else if key = "right" and m.alpha.isinFocusChain()
m.top.alphaActive = false
m.Alpha.setFocus(false)
m.Alpha.visible = true
m.alphaMenu.setFocus(false)
topGrp.setFocus(true)
return true
else if key = "replay" and topGrp.isinFocusChain()
@ -874,7 +881,7 @@ sub updateTitle()
m.top.overhangTitle = m.top.parentItem.title + tr(" (Filtered by ") + m.loadItemsTask.searchTerm + ")"
end if
if m.top.alphaSelected <> ""
if m.loadItemsTask.nameStartsWith <> ""
m.top.overhangTitle = m.top.parentItem.title + tr(" (Filtered by ") + m.loadItemsTask.nameStartsWith + ")"
end if

View File

@ -18,15 +18,13 @@
<RowList opacity="0" id="genrelist" translation="[120, 160]" showRowLabel="true" itemComponentName="GridItemSmall" numColumns="1" numRows="3" vertFocusAnimationStyle="fixed" itemSize="[1900, 360]" rowItemSize="[ [230, 320] ]" rowItemSpacing="[ [20, 0] ]" itemSpacing="[0, 60]" />
<Label id="micButtonText" font="font:SmallSystemFont" visible="false" />
<Button id="micButton" maxWidth="20" translation="[20, 120]" iconUri="pkg:/images/icons/mic_icon.png" />
<Label translation="[0,540]" id="emptyText" font="font:LargeSystemFont" width="1910" horizAlign="center" vertAlign="center" height="64" visible="false" />
<ItemGridOptions id="options" visible="false" />
<Animation id="backroundSwapAnimation" duration="1" repeat="false" easeFunction="linear">
<FloatFieldInterpolator id="fadeinLoading" key="[0.0, 1.0]" keyValue="[ 0.00, 0.25 ]" fieldToInterp="backdropTransition.opacity" />
<FloatFieldInterpolator id="fadeoutLoaded" key="[0.0, 1.0]" keyValue="[ 0.25, 0.00 ]" fieldToInterp="backdrop.opacity" />
</Animation>
<Alpha id="AlphaMenu" />
<Alpha id="alpha" />
</children>
<interface>
<field id="HomeLibraryItem" type="string" />
@ -34,7 +32,7 @@
<field id="selectedItem" type="node" alwaysNotify="true" />
<field id="quickPlayNode" type="node" alwaysNotify="true" />
<field id="imageDisplayMode" type="string" value="scaleToZoom" />
<field id="AlphaSelected" type="string" alias="AlphaMenu.itemAlphaSelected" alwaysNotify="true" onChange="onItemAlphaSelected" />
<field id="alphaSelected" type="string" alias="alpha.letterSelected" alwaysNotify="true" onChange="alphaSelectedChanged" />
<field id="alphaActive" type="boolean" value="false" />
<field id="jumpToItem" type="integer" value="" />
</interface>

View File

@ -17,10 +17,8 @@ sub setupNodes()
m.selectedMovieOfficialRating = m.top.findNode("selectedMovieOfficialRating")
m.movieLogo = m.top.findNode("movieLogo")
m.swapAnimation = m.top.findNode("backroundSwapAnimation")
m.Alpha = m.top.findNode("AlphaMenu")
m.AlphaSelected = m.top.findNode("AlphaSelected")
m.micButton = m.top.findNode("micButton")
m.micButtonText = m.top.findNode("micButtonText")
m.alpha = m.top.findNode("alpha")
m.alphaMenu = m.alpha.findNode("alphaMenu")
m.communityRatingGroup = m.top.findNode("communityRatingGroup")
m.criticRatingIcon = m.top.findNode("criticRatingIcon")
m.criticRatingGroup = m.top.findNode("criticRatingGroup")
@ -35,6 +33,12 @@ sub init()
m.overhang.isVisible = false
' adjust alpha menu mic icon since there is no overhang
alphaMic = m.alpha.findNode("alphaMic")
alphaMic.translation = [60, 150]
alphaMicText = m.alpha.findNode("alphaMicText")
alphaMicText.visible = false
m.showItemCount = m.global.session.user.settings["itemgrid.showItemCount"]
m.swapAnimation.observeField("state", "swapDone")
@ -52,7 +56,6 @@ sub init()
m.itemGrid.observeField("itemFocused", "onItemFocused")
m.itemGrid.observeField("itemSelected", "onItemSelected")
m.itemGrid.observeField("alphaSelected", "onItemalphaSelected")
'Voice filter setup
m.voiceBox.voiceEnabled = true
@ -84,12 +87,6 @@ sub init()
'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]
'Hide voice search if device does not have voice remote
if m.global.device.hasVoiceRemote = false
m.micButton.visible = false
m.micButtonText.visible = false
end if
end sub
sub OnScreenHidden()
@ -160,7 +157,12 @@ sub loadInitialItems()
m.loadItemsTask.itemId = m.top.parentItem.Id
end if
m.loadItemsTask.nameStartsWith = m.top.alphaSelected
' if we already searched for this alpha text than reset filter
if m.loadItemsTask.nameStartsWith = m.top.alphaSelected
m.loadItemsTask.nameStartsWith = ""
else
m.loadItemsTask.nameStartsWith = m.alpha.letterSelected
end if
m.loadItemsTask.searchTerm = m.voiceBox.text
m.emptyText.visible = false
m.loadItemsTask.sortField = m.sortField
@ -408,7 +410,6 @@ end sub
'
'Handle loaded data, and add to Grid
sub ItemDataLoaded(msg)
m.top.alphaActive = false
itemData = msg.GetData()
m.loadItemsTask.unobserveField("content")
m.loadItemsTask.content = []
@ -441,11 +442,17 @@ sub ItemDataLoaded(msg)
return
end if
' keep focus on alpha menu if it's active
if m.top.alphaActive
m.alphaMenu.setFocus(true)
else
m.itemGrid.opacity = "1"
m.genreList.opacity = "0"
m.alphaMenu.setFocus(false)
m.itemGrid.setFocus(true)
m.genreList.setFocus(false)
end if
if m.data.getChildCount() = 0
m.itemGrid.jumpToItem = 0
@ -722,7 +729,7 @@ sub onGenreItemSelected()
m.top.selectedItem = m.genreList.content.getChild(m.genreList.rowItemSelected[0]).getChild(m.genreList.rowItemSelected[1])
end sub
sub onItemalphaSelected()
sub alphaSelectedChanged()
if m.top.alphaSelected <> ""
m.loadedRows = 0
m.loadedItems = 0
@ -735,7 +742,6 @@ sub onItemalphaSelected()
m.loadItemsTask.searchTerm = ""
m.VoiceBox.text = ""
m.loadItemsTask.nameStartsWith = m.alpha.itemAlphaSelected
loadInitialItems()
end if
end sub
@ -750,6 +756,26 @@ sub onvoiceFilter()
m.loadItemsTask.NameStartsWith = " "
m.loadItemsTask.searchTerm = m.voiceBox.text
m.loadItemsTask.recursive = true
if m.voiceBox.text.len() = 1
' move focus to the letter spoken
alphaMenu = m.top.findNode("alphaMenu")
intConversion = m.voiceBox.text.ToInt() ' non numeric input returns as 0
if m.voiceBox.text = "0" or (isValid(intConversion) and intConversion <> 0)
alphaMenu.jumpToItem = 0
else
' loop through each option until we find a match
for i = 1 to alphaMenu.numRows - 1
alphaMenuOption = alphaMenu.content.getChild(i)
if Lcase(alphaMenuOption.TITLE) = Lcase(m.voiceBox.text)
alphaMenu.jumpToItem = i
exit for
end if
end for
end if
end if
loadInitialItems()
end if
end sub
@ -884,21 +910,18 @@ function onKeyEvent(key as string, press as boolean) as boolean
if m.itemGrid.isinFocusChain()
m.top.alphaActive = true
m.itemGrid.setFocus(false)
alpha = m.alpha.getChild(0).findNode("Alphamenu")
alpha.setFocus(true)
m.alphaMenu.setFocus(true)
return true
else if m.genreList.isinFocusChain()
m.top.alphaActive = true
m.genreList.setFocus(false)
alpha = m.alpha.getChild(0).findNode("Alphamenu")
alpha.setFocus(true)
m.alphaMenu.setFocus(true)
return true
end if
else if key = "right" and m.Alpha.isinFocusChain()
else if key = "right" and m.alpha.isinFocusChain()
m.top.alphaActive = false
m.Alpha.setFocus(false)
m.Alpha.visible = true
m.alphaMenu.setFocus(false)
m.itemGrid.setFocus(m.itemGrid.opacity = 1)
m.genreList.setFocus(m.genreList.opacity = 1)

View File

@ -35,15 +35,13 @@
<MarkupGrid id="itemGrid" itemComponentName="GridItemSmall" numColumns="7" numRows="2" vertFocusAnimationStyle="fixed" itemSize="[230, 310]" itemSpacing="[20, 20]" />
<RowList opacity="0" id="genrelist" translation="[120, 60]" showRowLabel="true" itemComponentName="GridItemSmall" numColumns="1" numRows="3" vertFocusAnimationStyle="fixed" itemSize="[1900, 360]" rowItemSize="[ [230, 320] ]" rowItemSpacing="[ [20, 0] ]" itemSpacing="[0, 60]" />
<Label id="micButtonText" font="font:SmallSystemFont" visible="false" />
<Button id="micButton" maxWidth="20" translation="[20, 120]" iconUri="pkg:/images/icons/mic_icon.png" />
<Label translation="[0,540]" id="emptyText" font="font:LargeSystemFont" width="1910" horizAlign="center" vertAlign="center" height="64" visible="false" />
<ItemGridOptions id="options" visible="false" />
<Animation id="backroundSwapAnimation" duration="1" repeat="false" easeFunction="linear">
<FloatFieldInterpolator id="fadeinLoading" key="[0.0, 1.0]" keyValue="[ 0.00, 1.00 ]" fieldToInterp="backdropTransition.opacity" />
<FloatFieldInterpolator id="fadeoutLoaded" key="[0.0, 1.0]" keyValue="[ 1.00, 0.00 ]" fieldToInterp="backdrop.opacity" />
</Animation>
<Alpha id="AlphaMenu" />
<Alpha id="alpha" />
</children>
<interface>
<field id="HomeLibraryItem" type="string" />
@ -51,7 +49,7 @@
<field id="selectedItem" type="node" alwaysNotify="true" />
<field id="quickPlayNode" type="node" alwaysNotify="true" />
<field id="imageDisplayMode" type="string" value="scaleToZoom" />
<field id="AlphaSelected" type="string" alias="AlphaMenu.itemAlphaSelected" alwaysNotify="true" onChange="onItemAlphaSelected" />
<field id="alphaSelected" type="string" alias="alpha.letterSelected" onChange="alphaSelectedChanged" alwaysNotify="true" />
<field id="alphaActive" type="boolean" value="false" />
<field id="showItemTitles" type="string" value="showonhover" />
<field id="jumpToItem" type="integer" value="" />

View File

@ -17,10 +17,8 @@ sub setupNodes()
m.selectedArtistGenres = m.top.findNode("selectedArtistGenres")
m.artistLogo = m.top.findNode("artistLogo")
m.swapAnimation = m.top.findNode("backroundSwapAnimation")
m.Alpha = m.top.findNode("AlphaMenu")
m.AlphaSelected = m.top.findNode("AlphaSelected")
m.micButton = m.top.findNode("micButton")
m.micButtonText = m.top.findNode("micButtonText")
m.alpha = m.top.findNode("alpha")
m.alphaMenu = m.alpha.findNode("alphaMenu")
m.overhang = m.top.getScene().findNode("overhang")
m.genreList = m.top.findNode("genrelist")
end sub
@ -30,6 +28,12 @@ sub init()
m.overhang.isVisible = false
' adjust alpha menu mic icon since there is no overhang
alphaMic = m.alpha.findNode("alphaMic")
alphaMic.translation = [60, 150]
alphaMicText = m.alpha.findNode("alphaMicText")
alphaMicText.visible = false
m.showItemCount = m.global.session.user.settings["itemgrid.showItemCount"]
m.swapAnimation.observeField("state", "swapDone")
@ -48,7 +52,6 @@ sub init()
m.itemGrid.observeField("itemFocused", "onItemFocused")
m.itemGrid.observeField("itemSelected", "onItemSelected")
m.itemGrid.observeField("alphaSelected", "onItemalphaSelected")
'Voice filter setup
m.voiceBox.voiceEnabled = true
@ -78,12 +81,6 @@ sub init()
'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]
'Hide voice search if device does not have voice remote
if m.global.device.hasVoiceRemote = false
m.micButton.visible = false
m.micButtonText.visible = false
end if
end sub
sub OnScreenHidden()
@ -150,7 +147,12 @@ sub loadInitialItems()
m.loadItemsTask.itemId = m.top.parentItem.Id
end if
m.loadItemsTask.nameStartsWith = m.top.alphaSelected
' if we already searched for this alpha text than reset filter
if m.loadItemsTask.nameStartsWith = m.top.alphaSelected
m.loadItemsTask.nameStartsWith = ""
else
m.loadItemsTask.nameStartsWith = m.alpha.letterSelected
end if
m.loadItemsTask.searchTerm = m.voiceBox.text
m.emptyText.visible = false
m.loadItemsTask.sortField = m.sortField
@ -323,14 +325,13 @@ end sub
'
'Handle loaded data, and add to Grid
sub ItemDataLoaded(msg)
stopLoadingSpinner()
m.top.alphaActive = false
itemData = msg.GetData()
m.loadItemsTask.unobserveField("content")
m.loadItemsTask.content = []
if itemData = invalid
m.Loading = false
stopLoadingSpinner()
return
end if
@ -349,14 +350,21 @@ sub ItemDataLoaded(msg)
m.loadedRows = m.loadedItems / m.genreList.numColumns
m.loading = false
stopLoadingSpinner()
return
end if
' keep focus on alpha menu if it's active
if m.top.alphaActive
m.alphaMenu.setFocus(true)
else
m.itemGrid.opacity = "1"
m.genreList.opacity = "0"
m.alphaMenu.setFocus(false)
m.itemGrid.setFocus(true)
m.genreList.setFocus(false)
end if
for each item in itemData
m.data.appendChild(item)
@ -371,6 +379,7 @@ sub ItemDataLoaded(msg)
m.emptyText.text = tr("NO_ITEMS").Replace("%1", m.top.parentItem.Type)
m.emptyText.visible = true
end if
stopLoadingSpinner()
end sub
'
@ -594,7 +603,7 @@ sub onGenreItemFocused()
end if
end sub
sub onItemalphaSelected()
sub alphaSelectedChanged()
if m.top.alphaSelected <> ""
m.loadedRows = 0
m.loadedItems = 0
@ -607,7 +616,6 @@ sub onItemalphaSelected()
m.loadItemsTask.searchTerm = ""
m.VoiceBox.text = ""
m.loadItemsTask.nameStartsWith = m.alpha.itemAlphaSelected
loadInitialItems()
end if
end sub
@ -622,7 +630,30 @@ sub onvoiceFilter()
m.loadItemsTask.NameStartsWith = " "
m.loadItemsTask.searchTerm = m.voiceBox.text
m.loadItemsTask.recursive = true
if m.voiceBox.text.len() = 1
' move focus to the letter spoken
intConversion = m.voiceBox.text.ToInt() ' non numeric input returns as 0
if m.voiceBox.text = "0" or (isValid(intConversion) and intConversion <> 0)
m.alphaMenu.jumpToItem = 0
else
' loop through each option until we find a match
for i = 1 to m.alphaMenu.numRows - 1
alphaMenuOption = m.alphaMenu.content.getChild(i)
if Lcase(alphaMenuOption.TITLE) = Lcase(m.voiceBox.text)
m.alphaMenu.jumpToItem = i
exit for
end if
end for
end if
end if
loadInitialItems()
if m.top.alphaActive
m.alphaMenu.setFocus(true)
end if
end if
end sub
@ -740,20 +771,17 @@ function onKeyEvent(key as string, press as boolean) as boolean
if m.itemGrid.isinFocusChain()
m.top.alphaActive = true
m.itemGrid.setFocus(false)
alpha = m.alpha.getChild(0).findNode("Alphamenu")
alpha.setFocus(true)
m.alphaMenu.setFocus(true)
return true
else if m.genreList.isinFocusChain()
m.top.alphaActive = true
m.genreList.setFocus(false)
alpha = m.alpha.getChild(0).findNode("Alphamenu")
alpha.setFocus(true)
m.alphaMenu.setFocus(true)
return true
end if
else if key = "right" and m.Alpha.isinFocusChain()
else if key = "right" and m.alpha.isinFocusChain()
m.top.alphaActive = false
m.Alpha.setFocus(false)
m.Alpha.visible = true
m.alphaMenu.setFocus(false)
m.itemGrid.setFocus(m.itemGrid.opacity = 1)
m.genreList.setFocus(m.genreList.opacity = 1)

View File

@ -20,15 +20,13 @@
<MarkupGrid id="itemGrid" itemComponentName="MusicArtistGridItem" numColumns="6" numRows="2" vertFocusAnimationStyle="fixed" itemSize="[280, 280]" itemSpacing="[20, 20]" />
<MarkupGrid id="genrelist" itemComponentName="MusicArtistGridItem" numColumns="6" numRows="4" vertFocusAnimationStyle="fixed" translation="[96, 60]" itemSize="[280, 280]" itemSpacing="[20, 20]" opacity="0" />
<Label id="micButtonText" font="font:SmallSystemFont" visible="false" />
<Button id="micButton" maxWidth="20" translation="[20, 120]" iconUri="pkg:/images/icons/mic_icon.png" />
<Label translation="[0,540]" id="emptyText" font="font:LargeSystemFont" width="1910" horizAlign="center" vertAlign="center" height="64" visible="false" />
<ItemGridOptions id="options" visible="false" />
<Animation id="backroundSwapAnimation" duration="1" repeat="false" easeFunction="linear">
<FloatFieldInterpolator id="fadeinLoading" key="[0.0, 1.0]" keyValue="[ 0.00, 1.00 ]" fieldToInterp="backdropTransition.opacity" />
<FloatFieldInterpolator id="fadeoutLoaded" key="[0.0, 1.0]" keyValue="[ 1.00, 0.00 ]" fieldToInterp="backdrop.opacity" />
</Animation>
<Alpha id="AlphaMenu" />
<Alpha id="alpha" />
</children>
<interface>
<field id="HomeLibraryItem" type="string" />
@ -36,7 +34,7 @@
<field id="selectedItem" type="node" alwaysNotify="true" />
<field id="quickPlayNode" type="node" alwaysNotify="true" />
<field id="imageDisplayMode" type="string" value="scaleToZoom" />
<field id="AlphaSelected" type="string" alias="AlphaMenu.itemAlphaSelected" alwaysNotify="true" onChange="onItemAlphaSelected" />
<field id="alphaSelected" type="string" alias="alpha.letterSelected" onChange="alphaSelectedChanged" alwaysNotify="true" />
<field id="alphaActive" type="boolean" value="false" />
<field id="showItemTitles" type="string" value="showonhover" />
<field id="jumpToItem" type="integer" value="" />