Skip to content

Commit

Permalink
fix early exit from settings screen
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Sep 24, 2023
1 parent 698720f commit 2af861f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions components/settings/settings.brs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "pkg:/source/utils/config.brs"
import "pkg:/source/utils/misc.brs"
import "pkg:/source/roku_modules/log/LogMixin.brs"
import "pkg:/source/api/sdk.bs"

sub init()
m.log = log.Logger("Settings")
Expand Down Expand Up @@ -202,16 +201,21 @@ sub radioSettingChanged()
set_user_setting(selectedSetting.settingName, m.radioSetting.content.getChild(m.radioSetting.checkedItem).id)
end sub

' Returns true if any of the data entry forms are in focus
function isFormInFocus() as boolean
if m.settingDetail.focusedChild <> invalid or m.radioSetting.hasFocus() or m.boolSetting.hasFocus() or m.integerSetting.hasFocus()
return true
end if
return false
end function

function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false

if (key = "back" or key = "left") and m.settingsMenu.focusedChild <> invalid and m.userLocation.Count() > 1
LoadMenu({})
return true
else if (key = "back" or key = "left") and m.settingDetail.focusedChild <> invalid
m.settingsMenu.setFocus(true)
return true
else if (key = "back" or key = "left") and m.radioSetting.hasFocus()
else if (key = "back" or key = "left") and isFormInFocus() = true
m.settingsMenu.setFocus(true)
return true
end if
Expand Down

0 comments on commit 2af861f

Please sign in to comment.