Gaia/Settings/docs/Keyboard Settings: Difference between revisions

From MozillaWiki
< Gaia‎ | Settings‎ | docs
Jump to navigation Jump to search
(Created page with "elements/keyboard.html elements/keyboard_selection_add_more.html '''"KeyboardContext"'''(js/modules/keyboard_context) is the core of the keyboard settings panels. It provides...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
elements/keyboard_selection_add_more.html
elements/keyboard_selection_add_more.html


'''"KeyboardContext"'''(js/modules/keyboard_context) is the core of the keyboard settings panels. It provides methods for retrieving installed keyboards and the currently enabled layouts. The information is provided using observable arrays. Whenever there is a new keyboard installed/uninstalled or a layout is enabled/disabled, '''"KeyboardHelper"'''(shared/keyboard_helper) notifies KeyboardContext and then it updates the corresponding arrays. The UI changes along with the arrays because we are using '''"ListView"'''(js/modules/mvvm/list_view) to render them.
'''"KeyboardContext"'''(js/modules/keyboard_context.js) is the core of the keyboard settings panels. It provides methods for retrieving installed keyboards and the currently enabled layouts. The information is provided using observable arrays. Whenever there is a new keyboard installed/uninstalled or a layout is enabled/disabled, '''"KeyboardHelper"'''(shared/keyboard_helper.js) notifies '''KeyboardContext''' and then it updates the corresponding arrays. On the other hand, '''KeyboardContext''' also observes the change of each layout item, so it can respond to the users requests for enabling layouts. The UI reflects to the array changes automatically because we are using '''"ListView"'''(js/modules/mvvm/list_view.js) to render them.
 
The tricky part of rendering keyboards is that the data structure of them is nested. Not only the keyboards need to be rendered but also the layouts contained in each keyboard. We used '''"NestedTemplateFactory"'''(panels/keyboard_add_layouts/nested_template_factory.js) to make the template function for the child items available to the one for the parent items.

Latest revision as of 03:11, 29 June 2015

elements/keyboard.html elements/keyboard_selection_add_more.html

"KeyboardContext"(js/modules/keyboard_context.js) is the core of the keyboard settings panels. It provides methods for retrieving installed keyboards and the currently enabled layouts. The information is provided using observable arrays. Whenever there is a new keyboard installed/uninstalled or a layout is enabled/disabled, "KeyboardHelper"(shared/keyboard_helper.js) notifies KeyboardContext and then it updates the corresponding arrays. On the other hand, KeyboardContext also observes the change of each layout item, so it can respond to the users requests for enabling layouts. The UI reflects to the array changes automatically because we are using "ListView"(js/modules/mvvm/list_view.js) to render them.

The tricky part of rendering keyboards is that the data structure of them is nested. Not only the keyboards need to be rendered but also the layouts contained in each keyboard. We used "NestedTemplateFactory"(panels/keyboard_add_layouts/nested_template_factory.js) to make the template function for the child items available to the one for the parent items.