Get started
Integration
The Common UI module is a core configuration module for all DriveKit UI modules.
To add Common UI module to your app, add the following line to your dependencies in your application build.gradle file:
Replace $drivekitui_version
with the DriveKit version you are using in your app
On a Github repository, you have a demo app and source code that you can use as an example.
Initialization
If you have disabled the SDK auto-initialization, an initialization phase is required to ensure that Common UI module works perfectly. To initialize Common UI module in your app, you must call the initialization method in onCreate
method of your application class.
This method will initialize the SDK with the default configuration set up by DriveQuant.
Configurations
Colors
The colors that can be configured are listed in the table below:
Name | Description | Default value |
| Main app color | #0B4D6E |
| Call to action color | #77E2B0 |
| Main font color | #161616 |
| Secondary font color | #9E9E9E |
| Color of a text displayed on an element whose color is | #FFFFFF |
| Color of a text displayed on an element whose color is | #FFFFFF |
| Background color | #FAFAFA |
| Color of the separating lines | #F0F0F0 |
| Warning color (non-critical hint) | #F7A334 |
| Alert color (critical hint) | #E52027 |
To override the default colors configuration, you just have to add the colors you want to change in the file res/values/colors.xml
in your app:
The flavor "colorsTest
" of the demo application is an example of colors customization.
Fonts
The Common UI configuration module allows to set up two fonts:
primaryFont
: this is the main font used in the application. The default value is Roboto.secondaryFont
: this font is used on the page titles or to emphasize a specific point. The default value is Roboto.
To override the primary font, define your font family in the file res/font/dkprimary.xml
in your app:
To override the secondary font, define your font family in the file res/font/dksecondary.xml
in your app:
The flavor "fontsTest
" of the demo application customizes the fonts to test and see where the different fonts are used.
Text Localization
Contents of each DriveKit UI module are translated into 7 languages: English, French, German, Spanish, Italian, Danish and Portuguese.
DriveKit simplifies the internationalization of your application and it is possible to add other languages.
DriveKit Common UI contains a number of basic text keys used in other DriveKit UI modules. You can override these keys to customize your application.
To help make the text keys in the code easier to read, a specific nomenclature has been set up: dk_<module name>_<key description>
.
For the Common UI module, all localizable keys are prefixed with: dk_common
.
There are several files containing text keys:
A string.xml file in the common UI module containing generic keys to all modules.
One file per UI module containing module-specific text keys.
Text customization
You can override any texts to customize your application. To override a text key, simply define the keys to be modified in a string.xml file at the application level. The text keys can be directly retrieved on Github, in the src/main/res/values folder of each module.
Add language
The translation file can be retrieved from GitHub in the various DriveKit UI modules and integrated into the values-<Locale> folder of the app.
Get analytics
You can retrieve some data and build analytics for any DriveKit UI component. To enable the feature, call the following method:
trackScreen()
method is called when a screen is displayed (i.e. trips list, trip detail, etc.).
When the method is called, you just have to call your analytics solution like Google Analytics for Firebase.
The screen
String received in the trackScreen
method is the value associated with one of the keys in this array, corresponding to the visited screen.
In order to customize screens values, you have to override keys you can find in dk_analytics.xml in each DriveKit UI component.
trackEvent()
allows adding additional information that may be useful for analysis. For example, that method is triggered each time the user is opening the trip detail screen.
Last updated