[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
[node8-android] appS8 UI framework
To model UI and UI navigation, you have the following main two classes available:
- AndroidCoordinator: it defines default UI controller.
- MainActivity: it's the container activity and entry point. It holds the navigator.
Other classes involved in UI -private to the framework- are:
- AndroidApplication: it defines main protocol for AndroidCoordinator instances switching.
- AndroidApplicationThread: it holds a stack of coordinators.
Read more UI internals
Adding a new tool to appS8
- add item menu name to MainActivity>>defaultNavMenuTitles array (this id will have to match YourTool class>>id)
- define view layout: add layout(s) for tool view(s) in: projectName\appS8\src\main\res\layout. By now xml layouts are added as Java resource layouts (layouts could be built programmatically)
- add the class for your tool:
- subclass AndroidCoordinator
- for the root coordinator, override #id to answer the id you defined for the name of the option in navigator (in MainActivity>>defaultNavMenuTitles)
- override #xmlLayout to return the name of the layout defined in res\layouts
- if there could be more than one coordinator of this class in the (AndroidApplication)Thread, override #canBeDuplicatedInThread to true
- override #open to do all necessary configurations to open your tool, extending superclass behavior
- add menu options: override/extend #defaultMenuOptions to define menu options array (right side menu)
- for each menu option a message named option name folling with Action will be sent when selecting the option. So ensure your tool understands xAction -if, for instance, the name of the option is X
- open a new coordinator: use #switchToUiNamed: to switch to a new coordinator.
- doing actions before or after switching to a coordinator:
- override (if itīs needed) #prePopActions (actions performed before current coordinator is replaced)
- override (if itīs needed) #postPushActions (actions performed after new coordinator is replaced)
- override (if itīs needed) #postPopActions (actions performed after current coordinator is replaced, but before new coordinator is pushed).
In general, adding UI and UI navigation to a new app
- if you are not extending appS8 but you are creating a new app, in order to use the UI framework, you will need:
- MainActivity.java
- projectName\s8 contents
- S8 Android base
- define build.gradle for the app (plus dependencies)
- to access a view use AndroidCoordinator>>viewNamed:
- to add a view to a container use AndroidCoordinator>>showView:inContainer:
ToDo list and Nice to Have features.