|
9 | 9 | m.log = log.Logger("TVShowDetails") |
10 | 10 | m.top.optionsAvailable = false |
11 | 11 | main = m.top.findNode("toplevel") |
12 | | - main.translation = [96, 175] |
| 12 | + main.translation = [96, 150] |
13 | 13 | m.tvshowPoster = m.top.findNode("tvshowPoster") |
14 | 14 | m.extrasSlider = m.top.findNode("tvSeasonExtras") |
15 | 15 | m.getShuffleEpisodesTask = createObject("roSGNode", "getShuffleEpisodesTask") |
|
44 | 44 |
|
45 | 45 | ' Restore focus for scene navigation |
46 | 46 | if isValid(m.top.lastFocus) |
47 | | - m.top.lastFocus.setFocus(true) |
| 47 | + ' Check if the focus target has a ready field (e.g., TextButton) and is not yet ready |
| 48 | + if m.top.lastFocus.hasField("ready") and not m.top.lastFocus.ready |
| 49 | + ' Component not ready yet, observe and set focus when ready |
| 50 | + m.top.lastFocus.observeField("ready", "onLastFocusReady") |
| 51 | + else |
| 52 | + ' Component is ready or doesn't need readiness check, set focus immediately |
| 53 | + m.top.lastFocus.setFocus(true) |
| 54 | + end if |
48 | 55 | else |
49 | 56 | m.top.setFocus(true) |
50 | 57 | end if |
51 | 58 | end sub |
52 | 59 |
|
| 60 | +sub onLastFocusReady() |
| 61 | + ' Called when the last focus target becomes ready |
| 62 | + if isValid(m.top.lastFocus) and m.top.lastFocus.ready |
| 63 | + m.top.lastFocus.unobserveField("ready") |
| 64 | + m.top.lastFocus.setFocus(true) |
| 65 | + end if |
| 66 | +end sub |
| 67 | + |
53 | 68 | sub itemContentChanged() |
54 | 69 | ' Updates video metadata |
55 | 70 | ' TODO - make things use item rather than itemData |
|
0 commit comments