|
27 | 27 | m.image = m.top.findNode("image") |
28 | 28 | m.favorite = m.top.findNode("favorite") |
29 | 29 |
|
30 | | - m.viewChannelFocusAnimationOpacity = m.top.findNode("viewChannelFocusAnimationOpacity") |
31 | | - m.recordFocusAnimationOpacity = m.top.findNode("recordFocusAnimationOpacity") |
32 | | - m.recordSeriesFocusAnimationOpacity = m.top.findNode("recordSeriesFocusAnimationOpacity") |
| 30 | + m.buttonsFocusAnimationOpacity = m.top.findNode("buttonsFocusAnimationOpacity") |
33 | 31 | m.focusAnimation = m.top.findNode("focusAnimation") |
34 | 32 |
|
| 33 | + m.buttons = m.top.findNode("buttons") |
35 | 34 | m.viewChannelButton = m.top.findNode("viewChannelButton") |
36 | 35 | m.recordButton = m.top.findNode("recordButton") |
37 | 36 | m.recordSeriesButton = m.top.findNode("recordSeriesButton") |
38 | 37 |
|
39 | | - m.viewChannelOutline = m.top.findNode("viewChannelOutline") |
40 | | - m.recordOutline = m.top.findNode("recordOutline") |
41 | | - m.recordSeriesOutline = m.top.findNode("recordSeriesOutline") |
42 | | - |
43 | | - m.viewChannelLabel = m.top.findNode("viewChannelButtonLabel") |
44 | | - m.recordLabel = m.top.findNode("recordButtonLabel") |
45 | | - m.recordSeriesLabel = m.top.findNode("recordSeriesButtonLabel") |
46 | | - |
47 | | - m.viewChannelButtonBackground = m.top.findNode("viewChannelButtonBackground") |
48 | | - m.recordButtonBackground = m.top.findNode("recordButtonBackground") |
49 | | - m.recordSeriesButtonBackground = m.top.findNode("recordSeriesButtonBackground") |
50 | | - |
51 | 38 | m.focusAnimation.observeField("state", "onAnimationComplete") |
| 39 | + m.buttons.observeField("buttonSelected", "onButtonSelected") |
52 | 40 |
|
53 | 41 | setupLabels() |
54 | 42 | end sub |
|
69 | 57 | isRepeatBackground.height = boundingRect.height + 8 |
70 | 58 | m.episodeDetailsGroup.removeChildIndex(0) |
71 | 59 |
|
72 | | - m.viewChannelLabel.text = tr("View Channel") |
73 | | - boundingRect = m.viewChannelButton.boundingRect() |
74 | | - viewButtonBackground = m.top.findNode("viewChannelButtonBackground") |
75 | | - viewButtonBackground.width = boundingRect.width + 20 |
76 | | - viewButtonBackground.height = boundingRect.height + 20 |
77 | | - m.viewChannelOutline.width = viewButtonBackground.width |
78 | | - m.viewChannelOutline.height = viewButtonBackground.height |
79 | | - |
80 | | - m.recordLabel.text = tr("Record") |
81 | | - boundingRect = m.recordButton.boundingRect() |
82 | | - recordButtonBackground = m.top.findNode("recordButtonBackground") |
83 | | - recordButtonBackground.width = boundingRect.width + 20 |
84 | | - recordButtonBackground.height = boundingRect.height + 20 |
85 | | - m.recordOutline.width = recordButtonBackground.width |
86 | | - m.recordOutline.height = recordButtonBackground.height |
87 | | - |
88 | | - m.recordSeriesLabel.text = tr("Record Series") |
89 | | - boundingRect = m.recordSeriesButton.boundingRect() |
90 | | - recordSeriesButtonBackground = m.top.findNode("recordSeriesButtonBackground") |
91 | | - recordSeriesButtonBackground.width = boundingRect.width + 20 |
92 | | - recordSeriesButtonBackground.height = boundingRect.height + 20 |
93 | | - m.recordSeriesOutline.width = recordSeriesButtonBackground.width |
94 | | - m.recordSeriesOutline.height = recordSeriesButtonBackground.height |
95 | | - |
| 60 | + ' Handle user recording permissions |
96 | 61 | m.userCanRecord = m.global.user.policy.enableLiveTvManagement |
97 | 62 | if m.userCanRecord = false |
98 | | - m.recordButton.visible = false |
99 | | - m.recordSeriesButton.visible = false |
| 63 | + m.recordButton.enabled = false |
| 64 | + m.recordSeriesButton.enabled = false |
100 | 65 | end if |
101 | 66 | end sub |
102 | 67 |
|
103 | 68 | sub updateLabels(recordText = tr("Record"), recordSeriesText = tr("Record Series")) |
104 | | - m.recordLabel.text = recordText |
105 | | - m.recordSeriesLabel.text = recordSeriesText |
106 | | - |
107 | | - boundingRect = m.recordButton.boundingRect() |
108 | | - recordButtonBackground = m.top.findNode("recordButtonBackground") |
109 | | - recordButtonBackground.width = boundingRect.width |
110 | | - recordButtonBackground.height = boundingRect.height |
111 | | - m.recordOutline.width = recordButtonBackground.width |
112 | | - m.recordOutline.height = recordButtonBackground.height |
113 | | - |
114 | | - boundingRect = m.recordSeriesButton.boundingRect() |
115 | | - recordSeriesButtonBackground = m.top.findNode("recordSeriesButtonBackground") |
116 | | - recordSeriesButtonBackground.width = boundingRect.width |
117 | | - recordSeriesButtonBackground.height = boundingRect.height |
118 | | - m.recordSeriesOutline.width = recordSeriesButtonBackground.width |
119 | | - m.recordSeriesOutline.height = recordSeriesButtonBackground.height |
| 69 | + m.recordButton.text = recordText |
| 70 | + m.recordSeriesButton.text = recordSeriesText |
120 | 71 | end sub |
121 | 72 |
|
122 | 73 | sub channelUpdated() |
|
222 | 173 | updateLabels() |
223 | 174 | end if |
224 | 175 |
|
225 | | - ' If not a series, hide Record Series button |
| 176 | + ' If not a series, hide Record Series button (doesn't make sense for non-series content) |
226 | 177 | if prog.json.isSeries <> true ' could be invalid or false |
227 | 178 | m.recordSeriesButton.visible = false |
| 179 | + m.recordSeriesButton.enabled = false |
228 | 180 | else |
229 | 181 | m.recordSeriesButton.visible = true |
| 182 | + ' Restore enabled state based on user permissions (set in setupLabels) |
| 183 | + m.recordSeriesButton.enabled = m.userCanRecord |
230 | 184 | end if |
231 | 185 |
|
232 | 186 | m.detailsView.visible = "true" |
|
294 | 248 | end function |
295 | 249 |
|
296 | 250 | ' |
297 | | -' Show view channel button when item has Focus |
| 251 | +' Show button group when item has Focus |
298 | 252 | sub focusChanged() |
299 | 253 | if m.top.hasFocus = true |
300 | 254 | m.overview.maxLines = m.maxDetailLines |
301 | | - m.viewChannelFocusAnimationOpacity.keyValue = [0, 1] |
302 | | - m.recordFocusAnimationOpacity.keyValue = [0, 1] |
303 | | - m.recordSeriesFocusAnimationOpacity.keyValue = [0, 1] |
304 | | - m.viewChannelButton.setFocus(true) |
305 | | - m.viewChannelOutline.visible = true |
306 | | - m.recordOutline.visible = false |
307 | | - m.recordSeriesOutline.visible = false |
308 | | - m.viewChannelButtonBackground.blendColor = "#006fab" |
309 | | - m.recordButtonBackground.blendColor = "#000000" |
310 | | - m.recordSeriesButtonBackground.blendColor = "#000000" |
| 255 | + m.buttonsFocusAnimationOpacity.keyValue = [0, 1] |
| 256 | + m.buttons.callFunc("focus") ' JRButtonGroup handles button focus |
311 | 257 | else |
312 | 258 | m.top.watchSelectedChannel = false |
313 | 259 | m.top.recordSelectedChannel = false |
314 | 260 | m.top.recordSeriesSelectedChannel = false |
315 | | - m.viewChannelFocusAnimationOpacity.keyValue = [1, 0] |
316 | | - m.recordFocusAnimationOpacity.keyValue = [1, 0] |
317 | | - m.recordSeriesFocusAnimationOpacity.keyValue = [1, 0] |
| 261 | + m.buttonsFocusAnimationOpacity.keyValue = [1, 0] |
318 | 262 | end if |
319 | 263 |
|
320 | 264 | m.focusAnimation.control = "start" |
|
327 | 271 | end if |
328 | 272 | end sub |
329 | 273 |
|
330 | | -function onKeyEvent(key as string, press as boolean) as boolean |
331 | | - if not press then return false |
| 274 | +' Handle button selection from JRButtonGroup |
| 275 | +sub onButtonSelected() |
| 276 | + selectedIndex = m.buttons.buttonSelected |
332 | 277 |
|
333 | | - if key = "OK" and m.viewChannelButton.hasFocus() |
| 278 | + ' Button indices: 0 = viewChannel, 1 = record, 2 = recordSeries |
| 279 | + if selectedIndex = 0 |
334 | 280 | m.top.watchSelectedChannel = true |
335 | | - return true |
336 | | - else if key = "OK" and m.recordButton.hasFocus() |
| 281 | + else if selectedIndex = 1 |
337 | 282 | m.top.recordSelectedChannel = true |
338 | | - return true |
339 | | - else if key = "OK" and m.recordSeriesButton.hasFocus() |
| 283 | + else if selectedIndex = 2 |
340 | 284 | m.top.recordSeriesSelectedChannel = true |
341 | | - return true |
342 | 285 | end if |
| 286 | +end sub |
343 | 287 |
|
344 | | - if m.userCanRecord = true |
345 | | - if key = "right" and m.viewChannelButton.hasFocus() |
346 | | - m.recordButton.setFocus(true) |
347 | | - m.viewChannelOutline.visible = false |
348 | | - m.recordOutline.visible = true |
349 | | - m.viewChannelButtonBackground.blendColor = "#000000" |
350 | | - m.recordButtonBackground.blendColor = "#006fab" |
351 | | - m.recordSeriesButtonBackground.blendColor = "#000000" |
352 | | - return true |
353 | | - else if key = "right" and m.recordButton.hasFocus() |
354 | | - m.recordSeriesButton.setFocus(true) |
355 | | - m.recordOutline.visible = false |
356 | | - m.recordSeriesOutline.visible = true |
357 | | - m.viewChannelButtonBackground.blendColor = "#000000" |
358 | | - m.recordButtonBackground.blendColor = "#000000" |
359 | | - m.recordSeriesButtonBackground.blendColor = "#006fab" |
360 | | - return true |
361 | | - else if key = "left" and m.recordSeriesButton.hasFocus() |
362 | | - m.recordButton.setFocus(true) |
363 | | - m.recordOutline.visible = true |
364 | | - m.recordSeriesOutline.visible = false |
365 | | - m.viewChannelButtonBackground.blendColor = "#000000" |
366 | | - m.recordButtonBackground.blendColor = "#006fab" |
367 | | - m.recordSeriesButtonBackground.blendColor = "#000000" |
368 | | - return true |
369 | | - else if key = "left" and m.recordButton.hasFocus() |
370 | | - m.viewChannelButton.setFocus(true) |
371 | | - m.viewChannelOutline.visible = true |
372 | | - m.recordOutline.visible = false |
373 | | - m.viewChannelButtonBackground.blendColor = "#006fab" |
374 | | - m.recordButtonBackground.blendColor = "#000000" |
375 | | - m.recordSeriesButtonBackground.blendColor = "#000000" |
376 | | - return true |
377 | | - end if |
378 | | - end if |
| 288 | +function onKeyEvent(key as string, press as boolean) as boolean |
| 289 | + if not press then return false |
379 | 290 |
|
| 291 | + ' Just prevent up/down from bubbling |
380 | 292 | if key = "up" or key = "down" |
381 | 293 | return true |
382 | 294 | end if |
|
0 commit comments