Working with new checkbox

This commit is contained in:
jimiatnymbl 2021-12-29 20:51:39 -07:00
parent 32cfd72d44
commit 1876dd29bd
5 changed files with 33 additions and 11 deletions

View File

@ -8,18 +8,24 @@ function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false if not press then return false
list = m.top.findNode("configOptions") list = m.top.findNode("configOptions")
checkbox = m.top.findNode("onOff")
button = m.top.findNode("submit") button = m.top.findNode("submit")
if key = "back" if key = "back"
m.top.backPressed = true m.top.backPressed = true
else if key = "down" and button.focusedChild = invalid else if key = "down" and checkbox.focusedChild = invalid and button.focusedChild = invalid
limit = list.content.getChildren(-1, 0).count() - 1 limit = list.content.getChildren(-1, 0).count() - 1
if limit = list.itemFocused if limit = list.itemFocused
m.top.setFocus(false) checkbox.setFocus(true)
button.setFocus(true)
return true return true
end if end if
else if key = "down" and button.focusedChild = invalid
button.setFocus(true)
return true
else if key = "up" and button.focusedChild <> invalid else if key = "up" and button.focusedChild <> invalid
checkbox.setFocus(true)
return true
else if key = "up" and checkbox.focusedChild <> invalid
list.setFocus(true) list.setFocus(true)
return true return true
end if end if

View File

@ -8,21 +8,20 @@
<ConfigList <ConfigList
id="configOptions" id="configOptions"
translation="[150, 240]" /> translation="[150, 240]" />
<label text="" <CheckList
id="example" id="onOff"
font="font:smallSystemFont" translation="[200, 450]" />
translation="[150, 350]" />
<Button <Button
id="submit" id="submit"
text="Submit" text="Submit"
showFocusFootprint="false" showFocusFootprint="false"
translation="[150, 450]" /> translation="[150, 550]" />
<label text="" <label text=""
id="alert" id="alert"
wrap="true" wrap="true"
width="1620" width="1620"
font="font:MediumSystemFont" font="font:MediumSystemFont"
translation="[150, 580]" /> translation="[150, 680]" />
</children> </children>
<script type="text/brightscript" uri="ConfigScene.brs"/> <script type="text/brightscript" uri="ConfigScene.brs"/>
</component> </component>

View File

@ -92,6 +92,10 @@
<source>Profile</source> <source>Profile</source>
<translation>Profile</translation> <translation>Profile</translation>
</message> </message>
<message>
<source>Save Credentials?</source>
<translation>Save Credentials?</translation>
</message>
<message> <message>
<source>Delete Saved</source> <source>Delete Saved</source>
<translation>Delete Saved</translation> <translation>Delete Saved</translation>

View File

@ -386,6 +386,7 @@ function LoginFlow(startOver = false as boolean)
passwordEntry = CreateSigninGroup(userSelected) passwordEntry = CreateSigninGroup(userSelected)
SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed
if passwordEntry = "backPressed" if passwordEntry = "backPressed"
m.global.sceneManager.callFunc("clearScenes")
return LoginFlow(true) return LoginFlow(true)
end if end if
end if end if

View File

@ -176,6 +176,16 @@ function CreateSigninGroup(user = "")
if get_setting("password") <> invalid if get_setting("password") <> invalid
password_field.value = get_setting("password") password_field.value = get_setting("password")
end if end if
' Add checkbox for saving credentials
checkbox = group.findNode("onOff")
items = CreateObject("roSGNode", "ContentNode")
items.role = "content"
saveCheckBox = CreateObject("roSGNode", "ContentNode")
saveCheckBox.title = tr("Save Credentials?")
items.appendChild(saveCheckBox)
checkbox.content = items
checkbox.checkedState = [true]
items = [username_field, password_field] items = [username_field, password_field]
config.configItems = items config.configItems = items
@ -206,8 +216,10 @@ function CreateSigninGroup(user = "")
if get_setting("active_user") <> invalid if get_setting("active_user") <> invalid
set_setting("username", username.value) set_setting("username", username.value)
set_setting("password", password.value) set_setting("password", password.value)
'Update our saved server list, so next time the user can just click and go if checkbox.checkedState[0] = true
UpdateSavedServerList() 'Update our saved server list, so next time the user can just click and go
UpdateSavedServerList()
end if
return "true" return "true"
end if end if
print "Login attempt failed..." print "Login attempt failed..."