Merge pull request #9 from sevenrats/candry-loadingux
simpler spinner code
This commit is contained in:
commit
e7d29ac1b5
|
@ -245,14 +245,6 @@ sub userMessage(title as string, message as string)
|
|||
m.scene.dialog = dialog
|
||||
end sub
|
||||
|
||||
'
|
||||
' Display Dialog to show user app is fetching server data
|
||||
sub progressDialog(title as string)
|
||||
dialog = createObject("roSGNode", "ProgressDialog")
|
||||
dialog.title = title
|
||||
m.scene.dialog = dialog
|
||||
end sub
|
||||
|
||||
'
|
||||
' Close currently displayed dialog
|
||||
sub dismiss_dialog()
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<function name="clearPreviousScene" />
|
||||
<function name="resetTime" />
|
||||
<function name="userMessage" />
|
||||
<function name="progressDialog" />
|
||||
<function name="dismiss_dialog" />
|
||||
<field id="currentUser" type="string" onChange="updateUser" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="SceneManager.brs" />
|
||||
|
|
|
@ -25,7 +25,6 @@ sub init()
|
|||
m.trailerButton.text = tr("Play Trailer")
|
||||
|
||||
m.top.observeField("itemContent", "itemContentChanged")
|
||||
m.top.findNode("communityRatingGroup").visible = false
|
||||
end sub
|
||||
|
||||
sub OnScreenShown()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<Label id="releaseYear" />
|
||||
<Label id="runtime" />
|
||||
<Label id="officialRating" />
|
||||
<LayoutGroup id="communityRatingGroup" layoutDirection="horiz" itemSpacings="[-5]">
|
||||
<LayoutGroup id="communityRatingGroup" layoutDirection="horiz" itemSpacings="[-5]" visible="false">
|
||||
<Poster id="star" uri="pkg:/images/sharp_star_white_18dp.png" height="32" width="32" blendColor="#cb272a" visible="false"/>
|
||||
<Label id="communityRating" />
|
||||
</LayoutGroup>
|
||||
|
|
|
@ -1021,18 +1021,6 @@
|
|||
<source>If enabled, the star and community rating for episodes of a TV show will be removed. This is to prevent spoilers of an upcoming good/bad episode.</source>
|
||||
<translation>If enabled, the star and community rating for episodes of a TV show will be removed. This is to prevent spoilers of an upcoming good/bad episode.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loading Episode Options</source>
|
||||
<translation>Loading Episode Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loading Video Options</source>
|
||||
<translation>Loading Video Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loading Movie Options</source>
|
||||
<translation>Loading Movie Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Playback Bitrate Limits</source>
|
||||
<translation>Playback Bitrate Limits</translation>
|
||||
|
|
|
@ -119,10 +119,8 @@ sub Main (args as dynamic) as void
|
|||
if itemNode = invalid or itemNode.id = "" then return
|
||||
if itemNode.type = "Episode" or itemNode.type = "Movie" or itemNode.type = "Video"
|
||||
if itemNode.type = "Episode" and itemNode.selectedAudioStreamIndex <> invalid and itemNode.selectedAudioStreamIndex > 1
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Episode Options"))
|
||||
video = CreateVideoPlayerGroup(itemNode.id, invalid, itemNode.selectedAudioStreamIndex)
|
||||
else
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Video Options"))
|
||||
video = CreateVideoPlayerGroup(itemNode.id)
|
||||
end if
|
||||
if video <> invalid and video.errorMsg <> "introaborted"
|
||||
|
@ -167,7 +165,6 @@ sub Main (args as dynamic) as void
|
|||
group = CreateItemGrid(selectedItem)
|
||||
sceneManager.callFunc("pushScene", group)
|
||||
else if selectedItem.type = "Episode"
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Episode Options"))
|
||||
' play episode
|
||||
' todo: create an episode page to link here
|
||||
video_id = selectedItem.id
|
||||
|
@ -238,7 +235,6 @@ sub Main (args as dynamic) as void
|
|||
node = getMsgPicker(msg, "picker")
|
||||
group = CreateMovieDetailsGroup(node)
|
||||
else if isNodeEvent(msg, "seriesSelected")
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Seriers Options"))
|
||||
' If you select a TV Series from ANYWHERE, follow this flow
|
||||
node = getMsgPicker(msg, "picker")
|
||||
group = CreateSeriesDetailsGroup(node)
|
||||
|
@ -320,7 +316,6 @@ sub Main (args as dynamic) as void
|
|||
else if isNodeEvent(msg, "episodeSelected")
|
||||
' If you select a TV Episode from ANYWHERE, follow this flow
|
||||
m.selectedItemType = "Episode"
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Episode Options"))
|
||||
node = getMsgPicker(msg, "picker")
|
||||
video_id = node.id
|
||||
if node.selectedAudioStreamIndex <> invalid and node.selectedAudioStreamIndex > 1
|
||||
|
@ -369,7 +364,6 @@ sub Main (args as dynamic) as void
|
|||
group = CreateVideoPlayerGroup(node.id)
|
||||
sceneManager.callFunc("pushScene", group)
|
||||
else if node.type = "Episode"
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Episode Options"))
|
||||
group = CreateVideoPlayerGroup(node.id)
|
||||
sceneManager.callFunc("pushScene", group)
|
||||
else if node.type = "Audio"
|
||||
|
@ -387,7 +381,6 @@ sub Main (args as dynamic) as void
|
|||
btn = getButton(msg)
|
||||
group = sceneManager.callFunc("getActiveScene")
|
||||
if btn <> invalid and btn.id = "play-button"
|
||||
m.global.sceneManager.callFunc("progressDialog", tr("Loading Movie Options"))
|
||||
|
||||
' Check if a specific Audio Stream was selected
|
||||
audio_stream_idx = 1
|
||||
|
|
|
@ -331,6 +331,7 @@ function CreateHomeGroup()
|
|||
end function
|
||||
|
||||
function CreateMovieDetailsGroup(movie)
|
||||
startLoadingSpinner()
|
||||
group = CreateObject("roSGNode", "MovieDetails")
|
||||
group.overhangTitle = movie.title
|
||||
group.optionsAvailable = false
|
||||
|
@ -353,15 +354,17 @@ function CreateMovieDetailsGroup(movie)
|
|||
extras = group.findNode("extrasGrid")
|
||||
extras.observeField("selectedItem", m.port)
|
||||
extras.callFunc("loadParts", movie.json)
|
||||
|
||||
stopLoadingSpinner()
|
||||
return group
|
||||
end function
|
||||
|
||||
function CreateSeriesDetailsGroup(series)
|
||||
startLoadingSpinner()
|
||||
' Get season data early in the function so we can check number of seasons.
|
||||
seasonData = TVSeasons(series.id)
|
||||
' Divert to season details if user setting goStraightToEpisodeListing is enabled and only one season exists.
|
||||
if get_user_setting("ui.tvshows.goStraightToEpisodeListing") = "true" and seasonData.Items.Count() = 1
|
||||
stopLoadingSpinner()
|
||||
return CreateSeasonDetailsGroupByID(series.id, seasonData.Items[0].id)
|
||||
end if
|
||||
group = CreateObject("roSGNode", "TVShowDetails")
|
||||
|
@ -376,7 +379,7 @@ function CreateSeriesDetailsGroup(series)
|
|||
extras = group.findNode("extrasGrid")
|
||||
extras.observeField("selectedItem", m.port)
|
||||
extras.callFunc("loadParts", group.itemcontent.json)
|
||||
|
||||
stopLoadingSpinner()
|
||||
return group
|
||||
end function
|
||||
|
||||
|
@ -446,6 +449,7 @@ function CreateAlbumView(album)
|
|||
end function
|
||||
|
||||
function CreateSeasonDetailsGroup(series, season)
|
||||
startLoadingSpinner()
|
||||
group = CreateObject("roSGNode", "TVEpisodes")
|
||||
group.optionsAvailable = false
|
||||
m.global.sceneManager.callFunc("pushScene", group)
|
||||
|
@ -456,10 +460,13 @@ function CreateSeasonDetailsGroup(series, season)
|
|||
group.observeField("episodeSelected", m.port)
|
||||
group.observeField("quickPlayNode", m.port)
|
||||
|
||||
stopLoadingSpinner()
|
||||
|
||||
return group
|
||||
end function
|
||||
|
||||
function CreateSeasonDetailsGroupByID(seriesID, seasonID)
|
||||
startLoadingSpinner()
|
||||
group = CreateObject("roSGNode", "TVEpisodes")
|
||||
group.optionsAvailable = false
|
||||
m.global.sceneManager.callFunc("pushScene", group)
|
||||
|
@ -469,7 +476,7 @@ function CreateSeasonDetailsGroupByID(seriesID, seasonID)
|
|||
|
||||
group.observeField("episodeSelected", m.port)
|
||||
group.observeField("quickPlayNode", m.port)
|
||||
|
||||
stopLoadingSpinner()
|
||||
return group
|
||||
end function
|
||||
|
||||
|
@ -513,7 +520,7 @@ sub CreateSidePanel(buttons, options)
|
|||
end sub
|
||||
|
||||
function CreateVideoPlayerGroup(video_id, mediaSourceId = invalid, audio_stream_idx = 1, forceTranscoding = false, showIntro = true, allowResumeDialog = true)
|
||||
|
||||
startMediaLoadingSpinner()
|
||||
' Video is Playing
|
||||
video = VideoPlayer(video_id, mediaSourceId, audio_stream_idx, defaultSubtitleTrackFromVid(video_id), forceTranscoding, showIntro, allowResumeDialog)
|
||||
|
||||
|
@ -522,17 +529,18 @@ function CreateVideoPlayerGroup(video_id, mediaSourceId = invalid, audio_stream_
|
|||
video.observeField("selectSubtitlePressed", m.port)
|
||||
video.observeField("selectPlaybackInfoPressed", m.port)
|
||||
video.observeField("state", m.port)
|
||||
|
||||
stopLoadingSpinner()
|
||||
return video
|
||||
end function
|
||||
|
||||
function CreatePersonView(personData as object) as object
|
||||
startLoadingSpinner()
|
||||
person = CreateObject("roSGNode", "PersonDetails")
|
||||
m.global.SceneManager.callFunc("pushScene", person)
|
||||
|
||||
info = ItemMetaData(personData.id)
|
||||
person.itemContent = info
|
||||
|
||||
stopLoadingSpinner()
|
||||
person.setFocus(true)
|
||||
person.observeField("selectedItem", m.port)
|
||||
person.findNode("favorite-button").observeField("buttonSelected", m.port)
|
||||
|
|
|
@ -9,6 +9,7 @@ function VideoPlayer(id, mediaSourceId = invalid, audio_stream_idx = 1, subtitle
|
|||
end if
|
||||
|
||||
if video.content = invalid
|
||||
stopLoadingSpinner()
|
||||
return invalid
|
||||
end if
|
||||
jellyfin_blue = "#00a4dcFF"
|
||||
|
@ -57,7 +58,9 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
|
|||
playbackPosition = meta.json.UserData.PlaybackPositionTicks
|
||||
if allowResumeDialog
|
||||
if playbackPosition > 0
|
||||
stopLoadingSpinner()
|
||||
dialogResult = startPlayBackOver(playbackPosition)
|
||||
startMediaLoadingSpinner()
|
||||
'Dialog returns -1 when back pressed, 0 for resume, and 1 for start over
|
||||
if dialogResult = -1
|
||||
'User pressed back, return invalid and don't load video
|
||||
|
@ -311,7 +314,6 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
|
|||
if not fully_external
|
||||
video.content = authorize_request(video.content)
|
||||
end if
|
||||
m.global.sceneManager.callFunc("dismiss_dialog")
|
||||
end sub
|
||||
|
||||
function PlayIntroVideo(video_id, audio_stream_idx) as boolean
|
||||
|
@ -368,8 +370,6 @@ end function
|
|||
|
||||
'Opens dialog asking user if they want to resume video or start playback over only on the home screen
|
||||
function startPlayBackOver(time as longinteger) as integer
|
||||
'Closes Loading Dialog
|
||||
m.global.sceneManager.callFunc("dismiss_dialog")
|
||||
if m.scene.focusedChild.focusedChild.overhangTitle = tr("Home") and (m.videotype = "Episode" or m.videotype = "Series")
|
||||
return option_dialog([tr("Resume playing at ") + ticksToHuman(time) + ".", tr("Start over from the beginning."), tr("Watched"), tr("Go to series"), tr("Go to season"), tr("Go to episode")])
|
||||
else
|
||||
|
|
|
@ -281,3 +281,28 @@ function findNodeBySubtype(node, subtype)
|
|||
|
||||
return foundNodes
|
||||
end function
|
||||
|
||||
sub startLoadingSpinner()
|
||||
m.spinner = createObject("roSGNode", "Spinner")
|
||||
m.spinner.translation = "[900, 450]"
|
||||
m.spinner.visible = true
|
||||
m.scene.appendChild(m.spinner)
|
||||
end sub
|
||||
|
||||
|
||||
sub startMediaLoadingSpinner()
|
||||
dialog = createObject("roSGNode", "ProgressDialog")
|
||||
dialog.id = "invisibiledialog"
|
||||
dialog.visible = false
|
||||
m.scene.dialog = dialog
|
||||
startLoadingSpinner()
|
||||
end sub
|
||||
|
||||
sub stopLoadingSpinner()
|
||||
if isValid(m.spinner)
|
||||
m.spinner.visible = false
|
||||
end if
|
||||
if isValid(m.scene.dialog)
|
||||
m.scene.dialog.close = true
|
||||
end if
|
||||
end sub
|
||||
|
|
Loading…
Reference in New Issue
Block a user