Customization
The QuickBlox UIKit for Android allows you to create your own unique view of the UIKit.
Themes
Default themes
Quickblox Android UIKit comes with two preset themes: light (LightUIKitTheme) and dark (DarkUIKitTheme). Both themes implement the UIKitTheme interface, which allows you to use them to customize the appearance of interface elements.
Light Theme
Dark Theme
Theme colors
The default themes in Quickblox Android UIKit already define primary colors corresponding to light and dark themes. However, you can also change the specific colors in the preset themes to tailor them to your needs.
In the example, we set the white color for the main text in the DarkUIKitTheme and set this theme to UIKit. So you can use the default pre-installed themes in Quickblox Android UIKit and change only the colors you need by overriding the appropriate attributes.
Important
Modified themes need to be set before launching UIKit screens and components.
Custom theme
But if you want to create a completely custom theme, it must also implement the UIKitTheme interface. You will be able to define and customize all colors and attributes to suit your needs.
After which you need to add your custom theme to UIKit:
Important
Modified themes need to be set before launching UIKit screens and components.
Screens
Creating a custom screen factory
The Quickblox Android UIKit provides an interface called ScreenFactory, which allows you to customize the creation of screens in your Android application. The default implementation of this interface is DefaultScreenFactory(), which creates screens using Fragments. However, if you need to replace a specific screen with your screen, you can create your own implementation of the ScreenFactory interface. This custom implementation will be responsible for creating the desired screens according to your requirements. This allows you to tailor the screen creation process to suit your application’s specific needs.
After which you need to set a custom factory in UIKit:
Important
Modified ScreenFactory need to be set before launching UIKit screens and components.
Customizing screens
In Quickblox Android UIKit, each screen accepts an instance of a specific implementation of the ScreenSettings interface as a constructor parameter. This ScreenSettings object is responsible for configuring the components and settings of the screen. It’s important to note that the ScreenSettings parameter is optional, and if not provided, the default implementation will be used.
The ScreenSettings interface allows you to define the properties and behavior of the screen components. It provides methods to show or hide specific components and allows you to set custom components for a particular screen. This gives you the flexibility to customize the appearance and functionality of each screen according to your specific requirements.
To create a ScreenSettings object, Quickblox Android UIKit utilizes the Builder pattern. This pattern allows you to conveniently set the desired properties and configurations for the screen. You can chain multiple methods calls to set various settings, such as showing or hiding specific components, setting custom components, or modifying any other relevant screen attributes.
By using the Builder pattern, you can create a ScreenSettings object with the desired configurations before passing it to the screen’s constructor. This approach simplifies the process of customizing and fine-tuning the screen’s appearance and behavior.
In this example, we showed how to add ScreenSettings with your own setting to the dialogs screen.
Of course, we don’t need to invoke all methods like in the code snippet above. We can invoke only the exact methods that we need. For example, if we need just to hide the search component the code will be like the snippet below:
Quick start using our Android UIKit sample
This sample implements authorization functionality and provides an example of color theme customization. Sample code available by this link. How to set up and run a sample, see the article in out blog Getting Started with the QuickBlox Android UIKit.
Was this page helpful?