Bookmarks (#153)
* Empty bookmarks screen * Bookmarks object * Long press support * Lint fix * Context menu v1 * A working context menu * Basic bookmarks in context menu * Use a root content node for bookmarks * context menu animation * small tweak * move logger around, adjust animation * Lint fix * Restore logger fix * Cache channel info * Bookmarks v1 * Added comment * Adjust "popular" feed error handling * Progress with bookmarks * Add todo * add todo * handle roDateTime logging * logger adjustment * Use yaml for api and layout * rename requestData to feedSource * Restructure things * Lint fix * remove comment * introduce feedSource id * small cleanup * playlist context menu * Context menu for the channel view * changelog --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
620a8a6e2b
commit
c740d5e0a0
63 files changed
+1889
-510
No files matched your search
@@ -0,0 +1,101 @@
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.noBookmarks = m.top.findNode("noBookmarks")
|
||||
m.yesBookmarks = m.top.findNode("yesBookmarks")
|
||||
m.rowList = m.top.FindNode("rowList")
|
||||
m.rowList.screen = m.top
|
||||
m.isDirty = true
|
||||
|
||||
m.top.ObserveField("visible", FuncName(OnVisibleChange))
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
SetNavigation(invalid, "back", m.navBar)
|
||||
SetNavigation(invalid, "left", m.navBar)
|
||||
|
||||
m.rowList@.BindNode(invalid)
|
||||
|
||||
OnBookmarksChange()
|
||||
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
if m.yesBookmarks.visible
|
||||
NodeSetFocus(m.rowList, true)
|
||||
else
|
||||
NodeSetFocus(m.navBar, true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVisibleChange()
|
||||
if m.top.visible and m.isDirty
|
||||
OnBookmarksChange()
|
||||
end if
|
||||
end function
|
||||
|
||||
function Refresh(unused as dynamic)
|
||||
m.isDirty = true
|
||||
OnBookmarksChange()
|
||||
end function
|
||||
|
||||
function OnBookmarksChange() as void
|
||||
if not m.top.visible
|
||||
m.isDirty = true
|
||||
return
|
||||
end if
|
||||
m.isDirty = false
|
||||
|
||||
hasBookmarks = m.bookmarks.content.getChildCount() > 0
|
||||
m.noBookmarks.visible = not hasBookmarks
|
||||
m.yesBookmarks.visible = hasBookmarks
|
||||
m.top.focusable = hasBookmarks
|
||||
|
||||
if hasBookmarks
|
||||
SetRowListContent(m.bookmarks.content)
|
||||
else
|
||||
if m.rowList.hasFocus()
|
||||
NodeSetFocus(m.navBar, true)
|
||||
end if
|
||||
end if
|
||||
end function
|
||||
|
||||
function SetRowListContent(bookmarksContent as object)
|
||||
bookmarkGroupNodes = bookmarksContent.getChildren(-1, 0)
|
||||
|
||||
feeds = []
|
||||
for each bookmarkGroupNode in bookmarkGroupNodes
|
||||
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
||||
feed = {
|
||||
title: bookmarkGroupNode.title,
|
||||
feedSources: []
|
||||
}
|
||||
|
||||
for each bookmarkNode in bookmarkNodes
|
||||
feed.feedSources.push(bookmarkNode.feedSource)
|
||||
end for
|
||||
|
||||
feeds.push(feed)
|
||||
end for
|
||||
|
||||
m.rowList.feeds = feeds
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if NavigationKeyHandler(key, press).handled
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(rowItem as object) as object
|
||||
refreshItem = ContextMenuUtils.CreateOption("Refresh Bookmarks", m.top, "Refresh", [invalid])
|
||||
return [refreshItem]
|
||||
end function
|
||||
Reference in new issue
Block a user