In v3 of UIKit for Android, you need a module and components to create a view. Components are the smallest unit of customizable views that can make up a whole screen and the module coordinates these components to be shown as the fragment's view. Each module also has its own customizable style per screen. You can change these style resources to create and customize your own module.
Create a view
To compose the screen of the fragment, you need to first create a view. In UIKit for Android, each screen has a module that can build a view. When the
onCreate() method of the fragment is called, it first creates a module. Then using the module, the fragment automatically builds a view by calling the
onCreateView() method. Refer to the codes below to see how a module uses different components to compose a screen.
Note: All modules in UIKit inherit the
BaseModuleclass and components are created simultaneously as when the module is created.
The view created from the module above is then used as a view in the fragment to display the screen.
Modules and their components
The following table shows a list of all components used in each module.
Set initial data values of a view
The initial data values of a view, such as UI-related resources, need to be set before creating the view because they decide what values the
onConfigureParams class of the module and components will be. After the view has been created, you can bind event handlers to each component using an
onBind* method, such as
onBindHeaderComponent, so that the fragment can receive events that occur in the view. If you want to override and set your own event handler to the component, we recommend you to do so after the
onBind* method has already been called. Refer to the code below to see how
ChannelListFragment binds event handlers to the
Note: If you're using a custom fragment and have overrided the
onBeforeReady()method, you need to call
super.onBeforeReady()in order to use the binding method of the component.
If you wish to customize default data and event handlers used in the modules and components, you can change the APIs of each fragment's builder class. There are some APIs in the builder that allows you to create fragments, modules, and components without the need for customization. Refer to the code below to see a list of all APIs in a builder.