Search filters (#145)
No files matched your search
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- A field to indicate when a playlist was last updated
|
- A field to indicate when a playlist was last updated
|
||||||
- Voice search in search page
|
- Voice search in search page
|
||||||
- Basic support for channels (open channel, see latest videos)
|
- Basic support for channels (open channel, see latest videos)
|
||||||
|
- Search filters (Upload date, type, duration, features, and sort by)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
width="104"
|
width="104"
|
||||||
height="104"
|
height="104"
|
||||||
uri="pkg:/images/circle-mask-500.png">
|
uri="pkg:/images/circle-mask-500.png">
|
||||||
<!-- TODO:P1 figure out why the masksize need to be 150 but the image is 100 -->
|
<!-- TODO:P0 figure out why the masksize need to be 150 but the image is 100 -->
|
||||||
<MaskGroup
|
<MaskGroup
|
||||||
translation="[2,2]"
|
translation="[2,2]"
|
||||||
masksize="[150,150]"
|
masksize="[150,150]"
|
||||||
|
|||||||
@@ -0,0 +1,273 @@
|
|||||||
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||||
|
import "pkg:/source/utils/ArrayUtils.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
options = {
|
||||||
|
date: [{
|
||||||
|
title: "Any date",
|
||||||
|
value: ""
|
||||||
|
}, {
|
||||||
|
title: "Last hour",
|
||||||
|
value: "hour"
|
||||||
|
}, {
|
||||||
|
title: "Today",
|
||||||
|
value: "today"
|
||||||
|
}, {
|
||||||
|
title: "This week",
|
||||||
|
value: "week"
|
||||||
|
}, {
|
||||||
|
title: "This month",
|
||||||
|
value: "month"
|
||||||
|
}, {
|
||||||
|
title: "This year",
|
||||||
|
value: "year"
|
||||||
|
}],
|
||||||
|
type: [{
|
||||||
|
title: "Any type",
|
||||||
|
value: ""
|
||||||
|
}, {
|
||||||
|
title: "Video",
|
||||||
|
value: "video"
|
||||||
|
}, {
|
||||||
|
title: "Playlist",
|
||||||
|
value: "playlist"
|
||||||
|
}, {
|
||||||
|
title: "Channel",
|
||||||
|
value: "channel"
|
||||||
|
}, {
|
||||||
|
title: "Movie",
|
||||||
|
value: "movie"
|
||||||
|
}, {
|
||||||
|
title: "Show",
|
||||||
|
value: "show"
|
||||||
|
}],
|
||||||
|
duration: [{
|
||||||
|
title: "Any duration",
|
||||||
|
value: ""
|
||||||
|
}, {
|
||||||
|
title: "Under 4 minutes",
|
||||||
|
value: "short"
|
||||||
|
}, {
|
||||||
|
title: "4 - 20 minutes",
|
||||||
|
value: "medium"
|
||||||
|
}, {
|
||||||
|
title: "Over 20 minutes",
|
||||||
|
value: "long"
|
||||||
|
}],
|
||||||
|
features: [{
|
||||||
|
title: "Live",
|
||||||
|
value: "live"
|
||||||
|
}, {
|
||||||
|
title: "4K",
|
||||||
|
value: "4k"
|
||||||
|
}, {
|
||||||
|
title: "HD",
|
||||||
|
value: "hd"
|
||||||
|
}, {
|
||||||
|
title: "Subtitles/CC",
|
||||||
|
value: "subtitles"
|
||||||
|
}, {
|
||||||
|
title: "Creative Commons",
|
||||||
|
value: "creative_commons"
|
||||||
|
}, {
|
||||||
|
title: "360°",
|
||||||
|
value: "360"
|
||||||
|
}, {
|
||||||
|
title: "VR180",
|
||||||
|
value: "vr180"
|
||||||
|
}, {
|
||||||
|
title: "3D",
|
||||||
|
value: "3d"
|
||||||
|
}, {
|
||||||
|
title: "HDR",
|
||||||
|
value: "hdr"
|
||||||
|
}, {
|
||||||
|
title: "Purchased",
|
||||||
|
value: "purchased"
|
||||||
|
}, {
|
||||||
|
title: "Location",
|
||||||
|
value: "location"
|
||||||
|
}],
|
||||||
|
sort_by: [{
|
||||||
|
title: "Relevance",
|
||||||
|
value: ""
|
||||||
|
}, {
|
||||||
|
title: "Upload date",
|
||||||
|
value: "upload_date"
|
||||||
|
}, {
|
||||||
|
title: "View count",
|
||||||
|
value: "view_count"
|
||||||
|
}, {
|
||||||
|
title: "Rating",
|
||||||
|
value: "rating"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
m.controls = {
|
||||||
|
date: m.top.findNode("UploadDateList"),
|
||||||
|
type: m.top.findNode("TypeList"),
|
||||||
|
duration: m.top.findNode("DurationList"),
|
||||||
|
features: m.top.findNode("FeaturesList"),
|
||||||
|
sort_by: m.top.findNode("SortByList")
|
||||||
|
}
|
||||||
|
|
||||||
|
for each filterKey in m.controls
|
||||||
|
control = m.controls[filterKey]
|
||||||
|
control.addFields({ filterKey: filterKey })
|
||||||
|
end for
|
||||||
|
|
||||||
|
m.contentNodes = {
|
||||||
|
date: m.controls.date.content,
|
||||||
|
type: m.controls.type.content,
|
||||||
|
duration: m.controls.duration.content,
|
||||||
|
features: m.controls.features.content,
|
||||||
|
sort_by: m.controls.sort_by.content
|
||||||
|
}
|
||||||
|
|
||||||
|
PopulateLists(m.contentNodes, options)
|
||||||
|
|
||||||
|
navigationNodes = [m.controls.date, m.controls.type, m.controls.duration, m.controls.features, m.controls.sort_by]
|
||||||
|
for i = 0 to navigationNodes.count() - 2
|
||||||
|
SetNavigation(navigationNodes[i], "right", navigationNodes[i + 1])
|
||||||
|
end for
|
||||||
|
for i = 1 to navigationNodes.count() - 1
|
||||||
|
SetNavigation(navigationNodes[i], "left", navigationNodes[i - 1])
|
||||||
|
end for
|
||||||
|
end function
|
||||||
|
|
||||||
|
function PopulateLists(contentNodes as object, options as object)
|
||||||
|
for each key in options
|
||||||
|
contentNode = contentNodes[key]
|
||||||
|
list = options[key]
|
||||||
|
for each item in list
|
||||||
|
node = CreateObject("roSGNode", "ContentNode")
|
||||||
|
node.title = item.title
|
||||||
|
node.addFields({ value: item.value })
|
||||||
|
contentNode.appendChild(node)
|
||||||
|
end for
|
||||||
|
end for
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnNodeReady()
|
||||||
|
m.log = new log.Logger("SearchFilters")
|
||||||
|
|
||||||
|
RefreshUI()
|
||||||
|
|
||||||
|
m.controls.date.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||||
|
m.controls.type.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||||
|
m.controls.duration.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||||
|
m.controls.features.ObserveField("checkedState", FuncName(OnListChecked))
|
||||||
|
m.controls.sort_by.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function RefreshUI()
|
||||||
|
filters = m.searchScreen.filters
|
||||||
|
for each key in filters
|
||||||
|
control = m.controls[key]
|
||||||
|
value = filters[key]
|
||||||
|
if IsString(value)
|
||||||
|
SetCheckedItem(control, value)
|
||||||
|
else if IsArray(value)
|
||||||
|
SetCheckedItemArray(control, value)
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
end function
|
||||||
|
|
||||||
|
function SetCheckedItem(control as object, value as string) as void
|
||||||
|
content = control.content
|
||||||
|
childCount = content.getChildCount()
|
||||||
|
for i = 0 to childCount - 1
|
||||||
|
child = content.getChild(i)
|
||||||
|
if child.value = value
|
||||||
|
control.checkedItem = i
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
end function
|
||||||
|
|
||||||
|
function SetCheckedItemArray(control as object, values as object) as void
|
||||||
|
content = control.content
|
||||||
|
childCount = content.getChildCount()
|
||||||
|
checkedState = []
|
||||||
|
for i = 0 to childCount - 1
|
||||||
|
child = content.getChild(i)
|
||||||
|
value = child.value
|
||||||
|
checkedState.push(ArrayUtils.IndexOfString(values, value) >= 0)
|
||||||
|
end for
|
||||||
|
control.checkedState = checkedState
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFocusChange() as void
|
||||||
|
if not m.top.focus
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
NodeSetFocus(m.controls.date, true)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnListChecked(event as object)
|
||||||
|
control = event.getRoSGNode()
|
||||||
|
filterKey = control.filterKey
|
||||||
|
|
||||||
|
state = m.searchScreen.filters
|
||||||
|
if IsString(state[filterKey])
|
||||||
|
SetFilterString(control)
|
||||||
|
else if IsArray(state[filterKey])
|
||||||
|
SetFilterArray(control)
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
function SetFilterString(control as object) as void
|
||||||
|
content = control.content
|
||||||
|
selectedNode = content.getChild(control.checkedItem)
|
||||||
|
value = selectedNode.value
|
||||||
|
|
||||||
|
filterKey = control.filterKey
|
||||||
|
state = m.searchScreen.filters
|
||||||
|
state[filterKey] = value
|
||||||
|
m.searchScreen.filters = state
|
||||||
|
end function
|
||||||
|
|
||||||
|
function SetFilterArray(control as object) as void
|
||||||
|
content = control.content
|
||||||
|
checkedState = control.checkedState
|
||||||
|
|
||||||
|
values = []
|
||||||
|
for i = 0 to checkedState.count() - 1
|
||||||
|
if checkedState[i]
|
||||||
|
node = content.getChild(i)
|
||||||
|
values.push(node.value)
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
|
||||||
|
filterKey = control.filterKey
|
||||||
|
state = m.searchScreen.filters
|
||||||
|
state[filterKey] = values
|
||||||
|
m.searchScreen.filters = state
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||||
|
navigation = NavigationKeyHandler(key, press)
|
||||||
|
if navigation.handled
|
||||||
|
m.currentNavigtionNode = navigation.node
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
if key = "options" and press
|
||||||
|
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
|
||||||
|
if key = "back" and press
|
||||||
|
Close()
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function Close()
|
||||||
|
m.appController@.PopScreen(invalid)
|
||||||
|
end function
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<component name="SearchFilters" extends="Group" includes="AutoBind,Focus">
|
||||||
|
<interface>
|
||||||
|
<field id="searchScreen" type="node" />
|
||||||
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
</interface>
|
||||||
|
<children>
|
||||||
|
<Rectangle
|
||||||
|
width="1280"
|
||||||
|
height="720"
|
||||||
|
color="#000000"
|
||||||
|
opacity="0.5">
|
||||||
|
</Rectangle>
|
||||||
|
<Font id="HeaderFont" uri="font:BoldSystemFontFile" size="18" />
|
||||||
|
<Font id="ItemFont" uri="font:SystemFontFile" size="18" />
|
||||||
|
<Font id="ItemFocusedFont" uri="font:BoldSystemFontFile" size="18" />
|
||||||
|
<Rectangle
|
||||||
|
width="1116"
|
||||||
|
height="543"
|
||||||
|
translation="[82,84]"
|
||||||
|
color="#242424">
|
||||||
|
|
||||||
|
<LayoutGroup
|
||||||
|
layoutDirection="horiz"
|
||||||
|
translation="[35,20]">
|
||||||
|
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||||
|
<Label
|
||||||
|
text="Upload date"
|
||||||
|
font="dictionary:HeaderFont"
|
||||||
|
horizAlign="center"
|
||||||
|
width="188" />
|
||||||
|
<Rectangle
|
||||||
|
width="170"
|
||||||
|
height="1" />
|
||||||
|
<RadioButtonList
|
||||||
|
id="UploadDateList"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
font="dictionary:ItemFont"
|
||||||
|
focusedFont="dictionary:ItemFocusedFont"
|
||||||
|
itemSize="[140,42]">
|
||||||
|
<ContentNode role="content" />
|
||||||
|
</RadioButtonList>
|
||||||
|
</LayoutGroup>
|
||||||
|
|
||||||
|
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||||
|
<Label
|
||||||
|
text="Type"
|
||||||
|
font="dictionary:HeaderFont"
|
||||||
|
horizAlign="center"
|
||||||
|
width="168" />
|
||||||
|
<Rectangle
|
||||||
|
width="150"
|
||||||
|
height="1" />
|
||||||
|
<RadioButtonList
|
||||||
|
id="TypeList"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
font="dictionary:ItemFont"
|
||||||
|
focusedFont="dictionary:ItemFocusedFont"
|
||||||
|
itemSize="[120,42]">
|
||||||
|
<ContentNode role="content" />
|
||||||
|
</RadioButtonList>
|
||||||
|
</LayoutGroup>
|
||||||
|
|
||||||
|
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||||
|
<Label
|
||||||
|
text="Duration"
|
||||||
|
font="dictionary:HeaderFont"
|
||||||
|
horizAlign="center"
|
||||||
|
width="238" />
|
||||||
|
<Rectangle
|
||||||
|
width="220"
|
||||||
|
height="1" />
|
||||||
|
<RadioButtonList
|
||||||
|
id="DurationList"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
font="dictionary:ItemFont"
|
||||||
|
focusedFont="dictionary:ItemFocusedFont"
|
||||||
|
itemSize="[190,42]">
|
||||||
|
<ContentNode role="content" />
|
||||||
|
</RadioButtonList>
|
||||||
|
</LayoutGroup>
|
||||||
|
|
||||||
|
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||||
|
<Label
|
||||||
|
text="Features"
|
||||||
|
font="dictionary:HeaderFont"
|
||||||
|
horizAlign="center"
|
||||||
|
width="258" />
|
||||||
|
<Rectangle
|
||||||
|
width="240"
|
||||||
|
height="1" />
|
||||||
|
<CheckList
|
||||||
|
id="FeaturesList"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
font="dictionary:ItemFont"
|
||||||
|
focusedFont="dictionary:ItemFocusedFont"
|
||||||
|
itemSize="[210,42]">
|
||||||
|
<ContentNode role="content" />
|
||||||
|
</CheckList>
|
||||||
|
</LayoutGroup>
|
||||||
|
|
||||||
|
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||||
|
<Label
|
||||||
|
text="Sort by"
|
||||||
|
font="dictionary:HeaderFont"
|
||||||
|
horizAlign="center"
|
||||||
|
width="198" />
|
||||||
|
<Rectangle
|
||||||
|
width="180"
|
||||||
|
height="1" />
|
||||||
|
<RadioButtonList
|
||||||
|
id="SortByList"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
font="dictionary:ItemFont"
|
||||||
|
focusedFont="dictionary:ItemFocusedFont"
|
||||||
|
itemSize="[150,42]">
|
||||||
|
<ContentNode role="content" />
|
||||||
|
</RadioButtonList>
|
||||||
|
</LayoutGroup>
|
||||||
|
</LayoutGroup>
|
||||||
|
</Rectangle>
|
||||||
|
</children>
|
||||||
|
</component>
|
||||||
@@ -14,10 +14,21 @@ function Init()
|
|||||||
m.scrollAnimation = m.top.FindNode("scrollAnimation")
|
m.scrollAnimation = m.top.FindNode("scrollAnimation")
|
||||||
m.scrollAnimationInterpolator = m.top.FindNode("scrollAnimationInterpolator")
|
m.scrollAnimationInterpolator = m.top.FindNode("scrollAnimationInterpolator")
|
||||||
m.suggestions = m.top.FindNode("suggestions")
|
m.suggestions = m.top.FindNode("suggestions")
|
||||||
|
m.filtersButton = m.top.FindNode("filtersButton")
|
||||||
|
|
||||||
textEditBox = m.keyboard.textEditBox
|
textEditBox = m.keyboard.textEditBox
|
||||||
textEditBox.voiceEntryType = "generic"
|
textEditBox.voiceEntryType = "generic"
|
||||||
textEditBox.voiceEnabled = true
|
textEditBox.voiceEnabled = true
|
||||||
|
|
||||||
|
m.top.filters = {
|
||||||
|
date: "",
|
||||||
|
type: "",
|
||||||
|
duration: "",
|
||||||
|
features: [],
|
||||||
|
sort_by: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
m.top.ObserveField("filters", FuncName(OnFiltersChange))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
@@ -27,6 +38,8 @@ function OnNodeReady()
|
|||||||
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
||||||
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
||||||
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
||||||
|
m.filtersButton.ObserveField("buttonSelected", FuncName(OnFiltersButtonSelected))
|
||||||
|
|
||||||
m.top.ObserveField("visible", FuncName(OnVisibilityChange))
|
m.top.ObserveField("visible", FuncName(OnVisibilityChange))
|
||||||
m.rowlist.ObserveFieldScoped("onError", FuncName(OnSearchError))
|
m.rowlist.ObserveFieldScoped("onError", FuncName(OnSearchError))
|
||||||
|
|
||||||
@@ -34,12 +47,17 @@ function OnNodeReady()
|
|||||||
ScrollUp()
|
ScrollUp()
|
||||||
end function)
|
end function)
|
||||||
SetNavigation(m.suggestions, "right", m.keyboard)
|
SetNavigation(m.suggestions, "right", m.keyboard)
|
||||||
|
SetNavigation(m.filtersButton, "right", m.keyboard)
|
||||||
SetNavigation(m.keyboard, "left", m.suggestions)
|
SetNavigation(m.keyboard, "left", m.suggestions)
|
||||||
SetNavigation(m.suggestions, "left", m.navBar)
|
SetNavigation(m.suggestions, "left", m.navBar)
|
||||||
|
SetNavigation(m.filtersButton, "left", m.navBar)
|
||||||
SetNavigation(m.keyboard, "left", m.navBar)
|
SetNavigation(m.keyboard, "left", m.navBar)
|
||||||
SetNavigation(m.rowList, "left", m.navBar, function()
|
SetNavigation(m.rowList, "left", m.navBar, function()
|
||||||
ScrollUp()
|
ScrollUp()
|
||||||
end function)
|
end function)
|
||||||
|
SetNavigation(m.filtersButton, "down", m.suggestions)
|
||||||
|
SetNavigation(m.filtersButton, "down", m.keyboard)
|
||||||
|
|
||||||
SetNavigation(invalid, "down", m.rowList, function()
|
SetNavigation(invalid, "down", m.rowList, function()
|
||||||
ScrollDown()
|
ScrollDown()
|
||||||
end function)
|
end function)
|
||||||
@@ -47,6 +65,8 @@ function OnNodeReady()
|
|||||||
ScrollUp()
|
ScrollUp()
|
||||||
end function)
|
end function)
|
||||||
|
|
||||||
|
SetNavigation(m.suggestions, "up", m.filtersButton)
|
||||||
|
|
||||||
m.currentNavigtionNode = m.suggestions
|
m.currentNavigtionNode = m.suggestions
|
||||||
' Trigger suggestions
|
' Trigger suggestions
|
||||||
OnTextChange()
|
OnTextChange()
|
||||||
@@ -123,6 +143,13 @@ function OnSearchSuggestionsTaskResults(output as object) as void
|
|||||||
m.suggestions.focusable = m.suggestions.buttons.Count() > 0
|
m.suggestions.focusable = m.suggestions.buttons.Count() > 0
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnFiltersButtonSelected()
|
||||||
|
searchFilters = CreateObject("roSGNode", "SearchFilters")
|
||||||
|
m.appController@.PushScreen(searchFilters)
|
||||||
|
searchFilters.searchScreen = m.top
|
||||||
|
searchFilters@.BindNode(invalid)
|
||||||
|
end function
|
||||||
|
|
||||||
function OnSearchButtonSelected()
|
function OnSearchButtonSelected()
|
||||||
selected = m.suggestions.buttonSelected
|
selected = m.suggestions.buttonSelected
|
||||||
text = m.suggestions.buttons[selected]
|
text = m.suggestions.buttons[selected]
|
||||||
@@ -149,19 +176,56 @@ function OnSearchButtonFocused() as void
|
|||||||
m.keyboard.text = text
|
m.keyboard.text = text
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnFiltersChange()
|
||||||
|
filterCount = 0
|
||||||
|
filters = m.top.filters
|
||||||
|
for each filter in filters
|
||||||
|
value = filters[filter]
|
||||||
|
if IsString(value) and value.len() > 0
|
||||||
|
filterCount++
|
||||||
|
else if IsArray(value) and value.Count() > 0
|
||||||
|
filterCount += value.Count()
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
if filterCount > 0
|
||||||
|
m.filtersButton.text = `Filters (${filterCount})`
|
||||||
|
else
|
||||||
|
m.filtersButton.text = "Filters"
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
function Search(text as string)
|
function Search(text as string)
|
||||||
m.rowlist.UnobserveFieldScoped("someContentReady")
|
m.rowlist.UnobserveFieldScoped("someContentReady")
|
||||||
|
' TODO:P1 someContentReady only fires if there are search results.
|
||||||
|
' The case where search results are empty is not handled.
|
||||||
m.rowlist.ObserveFieldScoped("someContentReady", FuncName(OnSearchContentReady))
|
m.rowlist.ObserveFieldScoped("someContentReady", FuncName(OnSearchContentReady))
|
||||||
ShowLoadingScreen()
|
ShowLoadingScreen()
|
||||||
|
|
||||||
m.rowList.contentData = [{
|
requestData = {
|
||||||
title: `Search - ${text}`,
|
title: `Search - ${text}`,
|
||||||
apiType: "Invidious",
|
apiType: "Invidious",
|
||||||
endpoint: "search",
|
endpoint: "search",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
q: text
|
q: text
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
|
||||||
|
filters = m.top.filters
|
||||||
|
for each filter in filters
|
||||||
|
value = filters[filter]
|
||||||
|
if IsString(value) and value.len() > 0
|
||||||
|
requestData.queryParams[filter] = value
|
||||||
|
else if IsArray(value) and value.Count() > 0
|
||||||
|
' TODO:P1 this is http client implementation details leaking
|
||||||
|
' We need a declarative way to set array types
|
||||||
|
requestData.queryParams[filter] = {
|
||||||
|
value: value,
|
||||||
|
__arrayType: HttpClient.QueryParamArrayType.CommaSeparated
|
||||||
|
}
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
|
||||||
|
m.rowList.contentData = [requestData]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSearchContentReady() as void
|
function OnSearchContentReady() as void
|
||||||
|
|||||||
@@ -4,9 +4,22 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<field id="navBar" type="node" bind="/NavBar" />
|
<field id="navBar" type="node" bind="/NavBar" />
|
||||||
<field id="invidious" type="node" bind="/Invidious" />
|
<field id="invidious" type="node" bind="/Invidious" />
|
||||||
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
<field id="filters" type="assocarray" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Group id="container">
|
<Group id="container">
|
||||||
|
<Button
|
||||||
|
id="filtersButton"
|
||||||
|
translation="[160,40]"
|
||||||
|
minWidth="0"
|
||||||
|
height="48"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
iconUri="pkg:/images/icons/filters-white.png"
|
||||||
|
focusedIconUri="pkg:/images/icons/filters-black.png"
|
||||||
|
text="Filters">
|
||||||
|
</Button>
|
||||||
|
|
||||||
<DynamicMiniKeyboard
|
<DynamicMiniKeyboard
|
||||||
id="keyboard"
|
id="keyboard"
|
||||||
translation="[730,110]"
|
translation="[730,110]"
|
||||||
|
|||||||
|
After Width: | Height: | Size: 316 B |
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||||
|
<path fill="#000000" d="M15 17h6v1h-6v-1zm-4 0H3v1h8v2h1v-5h-1v2zm3-9h1V3h-1v2H3v1h11v2zm4-3v1h3V5h-3zM6 14h1V9H6v2H3v1h3v2zm4-2h11v-1H10v1z"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 334 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||||
|
<path fill="#FFFFFF" d="M15 17h6v1h-6v-1zm-4 0H3v1h8v2h1v-5h-1v2zm3-9h1V3h-1v2H3v1h11v2zm4-3v1h3V5h-3zM6 14h1V9H6v2H3v1h3v2zm4-2h11v-1H10v1z"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1021 B After Width: | Height: | Size: 1021 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -48,7 +48,7 @@ const logoOutput = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const iconsInput = './playlet-app/src/images/vector/icons';
|
const iconsInput = './playlet-lib/src/images/vector/icons';
|
||||||
const iconsOutput = './playlet-lib/src/images/icons';
|
const iconsOutput = './playlet-lib/src/images/icons';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|||||||