forked from jellyfin/jellyfin-roku
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Movie Detail buttons to scrolling list
- Loading branch information
Showing
7 changed files
with
185 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sub init() | ||
end sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<component name="ButtonData" extends="ContentNode"> | ||
<interface> | ||
<field id="background" type="color" value="" /> | ||
<field id="focusBackground" type="color" value="" /> | ||
<field id="iconBlendColor" type="color" value="" /> | ||
<field id="textColor" type="color" value="" /> | ||
<field id="focusTextColor" type="color" value="" /> | ||
<field id="text" type="string" value="" /> | ||
<field id="padding" type="integer" value="-1" /> | ||
<field id="height" type="integer" value="" /> | ||
<field id="width" type="integer" value="" /> | ||
<field id="fontSize" type="integer" value="35" /> | ||
<field id="icon" type="string" value="" /> | ||
<field id="focusIcon" type="string" value="" /> | ||
<field id="iconSide" type="string" value="left" /> | ||
<field id="selected" type="boolean" value="false" /> | ||
<field id="focus" type="boolean" /> | ||
<field id="escape" type="string" value="" /> | ||
</interface> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import "pkg:/source/enums/ColorPalette.bs" | ||
|
||
sub init() | ||
m.buttonBackground = m.top.findNode("buttonBackground") | ||
m.buttonIcon = m.top.findNode("buttonIcon") | ||
m.buttonText = m.top.findNode("buttonText") | ||
end sub | ||
|
||
sub itemContentChanged() | ||
itemData = m.top.itemContent | ||
|
||
m.buttonText.color = ColorPalette.WHITE | ||
m.buttonText.font.size = itemData.fontSize | ||
m.buttonBackground.blendColor = ColorPalette.TRANSPARENT | ||
m.buttonIcon.uri = itemData.icon | ||
m.buttonIcon.blendcolor = itemData.iconBlendColor | ||
m.buttonText.text = itemData.text | ||
m.buttonBackground.height = itemData.height | ||
m.buttonBackground.width = itemData.width | ||
|
||
m.focusTextColor = ColorPalette.WHITE | ||
m.textColor = ColorPalette.WHITE | ||
m.focusBackground = ColorPalette.HIGHLIGHT | ||
m.focusIcon = itemData.focusIcon | ||
m.icon = itemData.icon | ||
m.background = ColorPalette.TRANSPARENT | ||
m.height = itemData.height | ||
m.width = itemData.width | ||
m.padding = itemData.padding | ||
m.iconSide = itemData.iconSide | ||
|
||
setIconSize() | ||
|
||
m.top.focus = itemData.focus | ||
onFocusChanged() | ||
end sub | ||
|
||
|
||
sub onFocusChanged() | ||
if m.top.focus | ||
m.buttonText.color = m.focusTextColor | ||
m.buttonIcon.uri = m.focusIcon <> "" ? m.focusIcon : m.icon | ||
else | ||
m.buttonText.color = m.textColor | ||
m.buttonIcon.uri = m.icon | ||
end if | ||
end sub | ||
|
||
sub setIconSize() | ||
height = m.buttonBackground.height | ||
width = m.buttonBackground.width | ||
if height > 0 and width > 0 | ||
' TODO: Use smallest number between them | ||
m.buttonIcon.height = m.height | ||
|
||
if m.padding > 0 | ||
m.buttonIcon.height = m.buttonIcon.height - m.padding | ||
end if | ||
|
||
m.buttonIcon.width = m.buttonIcon.height | ||
|
||
' Set Icon translation | ||
if LCase(m.iconSide) = "right" | ||
m.buttonIcon.translation = [m.buttonBackground.width - m.padding - m.buttonIcon.width, ((height - m.buttonIcon.height) / 2)] | ||
m.buttonText.translation = [m.padding, ((height - m.buttonText.font.size) / 2)] | ||
else | ||
m.buttonIcon.translation = [m.padding, ((height - m.buttonIcon.height) / 2)] | ||
m.buttonText.translation = [m.padding + m.buttonIcon.width + 20, ((height - m.buttonText.font.size) / 2)] | ||
end if | ||
|
||
' Set text max width | ||
m.buttonText.maxWidth = m.width - m.padding - m.buttonIcon.width - 40 | ||
end if | ||
end sub | ||
|
||
function onKeyEvent(key as string, press as boolean) as boolean | ||
if not press then return false | ||
|
||
if key = "right" and m.top.focus | ||
m.top.escape = "right" | ||
end if | ||
|
||
if key = "left" and m.top.focus | ||
m.top.escape = "left" | ||
end if | ||
|
||
return false | ||
end function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<component name="MovieDetailButton" extends="Group"> | ||
<children> | ||
<Poster id="buttonBackground" uri="pkg:/images/white.9.png" /> | ||
<Poster id="buttonIcon" /> | ||
<ScrollingLabel id="buttonText" font="font:MediumSystemFont" horizAlign="left" /> | ||
</children> | ||
<interface> | ||
<field id="itemContent" type="node" onChange="itemContentChanged" /> | ||
|
||
<field id="background" type="color" value="" /> | ||
<field id="focusBackground" type="color" value="" /> | ||
<field id="iconBlendColor" type="color" value="" /> | ||
<field id="textColor" type="color" value="" /> | ||
<field id="focusTextColor" type="color" value="" /> | ||
<field id="text" type="string" value="" /> | ||
<field id="padding" type="integer" value="-1" /> | ||
<field id="height" type="integer" value="" /> | ||
<field id="width" type="integer" value="" /> | ||
<field id="fontSize" type="integer" value="35" /> | ||
<field id="icon" type="string" value="" /> | ||
<field id="focusIcon" type="string" value="" /> | ||
<field id="iconSide" type="string" value="left" /> | ||
<field id="selected" type="boolean" value="false" /> | ||
<field id="focus" type="boolean" value="false" /> | ||
<field id="escape" type="string" value="" /> | ||
</interface> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters