LogoLogo
ProductsUse casesDocsSupport
  • Introducing DriveKit
  • DriveKit Guides
  • Get started with drivekit
    • Trip recording lifecycle
    • iOS
      • 🚀Quick start
      • Advanced configurations
      • References
      • iOS DriveKit Demo App
    • Android
      • 🚀Quick start
      • Advanced configurations
      • References
      • Android DriveKit Demo App
      • Android 15 Migration guide
      • Android 14 Migration guide
      • Troubleshooting
  • Trip analysis
    • Introduction
    • iOS
      • Permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (iOS)
    • Android
      • Runtime permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
      • Android
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
    • REST services
      • Trip
      • References
    • Trip Simulator
      • iOS
      • Android
  • PERMISSIONS UTILS
    • Introduction
    • User interface
      • iOS
        • Get started
        • Main configurations
      • Android
        • Get started
        • Main configurations
  • COMMON UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
    • References
  • DRIVER DATA
    • Introduction
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
      • Android
        • Get Started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
  • Driver Data Timeline UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • Vehicle
    • Introduction
    • iOS
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (iOS)
    • Android
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Main configurations
        • Advanced configurations
      • Android
        • Get started
        • Main configurations
        • Advanced configurations
  • DRIVER ACHIEVEMENT
    • Introduction
    • iOS
      • Get started
    • Android
      • Get Started
    • User interface
      • iOS
      • Android
  • CHALLENGE
    • Introduction
    • Important challenge rules
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
      • Android
        • Get started
  • GROUP
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • React Native
    • Get started
    • Integration
  • Flutter
    • Get started
    • Integration
  • Push services
    • Introduction
    • Push Trip Data
    • Push Deleted trip
    • Push Crash Data
    • Push Diagnosis Data
  • ADMIN SERVICES
    • Beacon
      • Add
      • Replace
      • Delete
      • Configuration
    • Challenges
      • List of challenges
      • Challenge details
      • Registered users
      • Challenge ranking
      • Users' progress
      • Definitions
    • Customer
      • Activity timeline
    • Driver
      • Timeline
      • Synthesis
      • Identity
      • Status
      • Add or update a metadata
      • Vehicles
      • Profile
      • Application diagnoses
    • Drivers
      • Account
      • Statistics
      • Ranking
      • Expired accounts
    • Group
      • Timeline
      • Synthesis
    • Trips
      • Add or update a metadata
      • Delete a metadata
    • Vehicle
      • Create
      • Characteristics
      • Configuration
      • Statistics
      • Update mileage
      • Tire and brake wear update
      • References
  • Crashes
    • Annotate a crash
    • Revoke crash location URL
  • ENTERPRISE SERVICES
    • Introduction
    • Teams
      • Create a team
      • List of teams
      • Enable or disable a team
    • Hyper-admins
      • Create a hyper-admin
      • List of hyper-admins
      • Delete a hyper-admin
    • Monitoring
      • Get a push trip data report
      • Get a push crash data report
      • Request to retry failed trips
      • Request to retry failed crashes
      • Get the status of a task
  • Release notes
    • Changelog
      • iOS
      • Android
      • UI iOS
      • UI Android
Powered by GitBook
On this page
  • Integration
  • Initialization
  • Configurations
  • Colors
  • Fonts
  • Text Localization
  • Text customization
  • Add language
  • Get analytics

Was this helpful?

Export as PDF
  1. COMMON UI
  2. Android

Get started

PreviousAndroidNextReferences

Last updated 11 months ago

Was this helpful?

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:

dependencies {
    implementation 'com.drivequant.drivekit:drivekit-common-ui:$drivekitui_version'
}

Replace $drivekitui_version with the DriveKit version you are using in your app

On a, you have a demo app and source code that you can use as an example.

Initialization

If you have , 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.

class MyApplication: Application() {
    override fun onCreate() {
        super.onCreate()
        (…)
        DriveKitUI.initialize()
    }
}
public class MyApplication extends Application {
   @Override
   public void onCreate() {
       super.onCreate();
       (…)
       DriveKitUI.initialize();
}}

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

primaryColor

Main app color

#0B4D6E

secondaryColor

Call to action color

#77E2B0

mainFontColor

Main font color

#161616

complementaryFontColor

Secondary font color

#9E9E9E

fontColorOnPrimaryColor

Color of a text displayed on an element whose color is primaryColor

#FFFFFF

fontColorOnSecondaryColor

Color of a text displayed on an element whose color is secondaryColor

#FFFFFF

backgroundViewColor

Background color

#FAFAFA

neutralColor

Color of the separating lines

#F0F0F0

warningColor

Warning color (non-critical hint)

#F7A334

criticalColor

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:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="primaryColor">#0B4D6E</color>
    <color name="secondaryColor">#77E2B0</color>
    <color name="mainFontColor">#161616</color>
    <color name="complementaryFontColor">#9E9E9E</color>
    <color name="fontColorOnPrimaryColor">@android:color/white</color>
    <color name="fontColorOnSecondaryColor">@android:color/white</color>
    <color name="backgroundViewColor">#FAFAFA</color>
    <color name="neutralColor">#F0F0F0</color>
    <color name="warningColor">#F7A334</color>
    <color name="criticalColor">#E52027</color>
</resources>

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:

  1. primaryFont: this is the main font used in the application. The default value is Roboto.

  2. 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:

<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
    <font
        app:font="@font/sketchy"
        app:fontStyle="normal"
        app:fontWeight="400" /> <!-- Weight 400 = Normal (Regular) -->
    <font
        app:font="@font/deadknight"
        app:fontStyle="normal"
        app:fontWeight="700" /> <!-- Weight 700 = Bold -->
</font-family>

To override the secondary font, define your font family in the file res/font/dksecondary.xml in your app:

<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
    <font app:font="@font/stocky" />
</font-family>

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

Add language

Get analytics

You can retrieve some data and build analytics for any DriveKit UI component. To enable the feature, call the following method:

DriveKitUI.configureAnalytics(object: DriveKitAnalyticsListener{
   override fun trackScreen(screen: String, className: String) {
       // TODO: manage screen tracking here
   }

   override fun trackEvent(event: DKAnalyticsEvent, parameters: Map<DKAnalyticsEventKey, String>) {
       // TODO: manage event tracking here
    }
})
DriveKitUI.configureAnalytics(new DriveKitAnalyticsListener() {
   @Override
   public void trackScreen(@NotNull String screen, @NotNull String className) {
       // TODO: manage screen tracking here
   }

   @Override
   public void trackEvent(@NotNull DKAnalyticsEvent event, @NotNull Map<DKAnalyticsEventKey, String> parameters) {
       // TODO: manage event tracking here
   }
});

trackScreen() method is called when a screen is displayed (i.e. trips list, trip detail, etc.).

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.

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 , in the src/main/res/values folder of each module.

The translation file can be retrieved from in the various DriveKit UI modules and integrated into the values-<Locale> folder of the app.

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 , corresponding to the visited screen.

Github
GitHub
in this array
Github repository
disabled the SDK auto-initialization