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
list = m.top.findNode("configOptions")
checkbox = m.top.findNode("onOff")
button = m.top.findNode("submit")
if key = "back"
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
if limit = list.itemFocused
m.top.setFocus(false)
button.setFocus(true)
checkbox.setFocus(true)
return true
end if
else if key = "down" and button.focusedChild = invalid
button.setFocus(true)
return true
else if key = "up" and button.focusedChild <> invalid
checkbox.setFocus(true)
return true
else if key = "up" and checkbox.focusedChild <> invalid
list.setFocus(true)
return true
end if

View File

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

View File

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

View File

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

View File

@ -176,6 +176,16 @@ function CreateSigninGroup(user = "")
if get_setting("password") <> invalid
password_field.value = get_setting("password")
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]
config.configItems = items
@ -206,8 +216,10 @@ function CreateSigninGroup(user = "")
if get_setting("active_user") <> invalid
set_setting("username", username.value)
set_setting("password", password.value)
'Update our saved server list, so next time the user can just click and go
UpdateSavedServerList()
if checkbox.checkedState[0] = true
'Update our saved server list, so next time the user can just click and go
UpdateSavedServerList()
end if
return "true"
end if
print "Login attempt failed..."