Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User setting screen #583

Merged
merged 3 commits into from
May 2, 2022
Merged

User setting screen #583

merged 3 commits into from
May 2, 2022

Conversation

neilsb
Copy link
Member

@neilsb neilsb commented May 1, 2022

Create a new user setting screen to allow setting and storing preferences on the Roku Device on a per user basis.

Screen it accessible via the * button on the home screen for now, under the "Settings" option. A folder/item type view is displayed which is built from the settings/settings.json file, meaning new settings can easily be added without having to update the settings page.

The settings.json is an array of configItem objects with the following properties

title : Short title for display in Menu & Top of setting panel
description : Description of the setting
settingName : Unique id to use when storing the setting in the registry
type : Type of setting (e.g. bool, number, text, etc)
default : Optional default value for setting
children : Array of configItem objects to appear under setting

It can be though of as a tree, with branches being the folders and the leaf nodes being the actual properties being set. For branches, type, default and settingName would not be set, and for lead nodes children would not be set.

Currently only type of bool is supported. This should be easy to extend with other types as they are needed and validation can be added in.

The MPEG 2 Support option has been moved into the new setting screen, and has also been moved from the application setting to a user setting (hence the migration code in the Main.brs file.

Once a new setting has been defined in the settings.json file, it can be accessed using the existing get_user_setting("key") method in config.brs file. They key is the settingName` from the entry in settings.json.

@neilsb
Copy link
Member Author

neilsb commented May 1, 2022

It doesn't look very impressive with only the MPEG 2 setting in there, but can knock off a new of the open issues now and look at adding support for text and number items shortly

Copy link
Contributor

@jimdogx jimdogx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I added a few dummy children and branch and it all worked as well as across servers.

I am getting the following warning though:

Warnings occurred while creating XML component Settings
-- Tried to set nonexistent field "width" of a "ScrollingLabel" node
pkg:/components/settings/settings.xml(34)

source/ShowScenes.brs Outdated Show resolved Hide resolved
@neilsb
Copy link
Member Author

neilsb commented May 2, 2022

-- Tried to set nonexistent field "width" of a "ScrollingLabel" node

Totally missed that, thanks. Was originally a label and changed to ScrollingLabel without fixing that property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants