3.3 VYou – UI

VYou-UI

Along with the Core SDK, we provide another library that provides built-in forms for registering a user and editing it’s profile. Those forms are dynamically built with the information configured in the back office.

Install

In order to install the VYou-UI SDK in your Android application you’ll need to add the following dependency inside your application-level build.gradle file

implementation "io.github.apiumhub:vyou-ui:1.0.2

Also, if you don’t have mavenCentral() as a repository, you should add it to your project-level build.gradle file

allprojects {
    repositories {
        mavenCentral()
        ...
    }
}

Important note Notice that VYou-Core is a dependency inside VYou-UI, so if you add VYou-UI to your project, you don’t need to add the VYou-Core dependency anymore.

Setup

Please refer to the VYou-Core setup, as you’ll have to follow all of the steps described on it.

Important note To make VYou-UI SDK work you must replace this line

VYou.initialize(this)

with the following

VYouUI.initialize(this)

As in the VYou-Core setup, you will need to call this function before the onCreate of your Activity or Fragment:

private val vyouUi = VYouUi(this)

API

As VYou-UI holds a dependency to VYou-Core, all of it’s API will still be available, so please take a look at it if you haven’t done so yet. The VYou-UI SDK provides methods to start the register & edit profile flows from your application

suspend fun startRegister(): VYouResult<Unit>
suspend fun startProfile(credentials: VYouCredentials): VYouResult<Unit>

Those two methods will start a new Activity inside your application, and return the result of any of the flows inside a VYouResult In order to launch the edit profile activity, you must provide the user’s credentials which are easily accessible through

Vyou.session?.credentials

Styling

In order to style the forms shown to the user, the SDK is integrated with the built-in theme system inside Android, so everything that’s configurable by the theme should also work inside the SDK. We provide the following example in the sample application

<resources xmlns:tools="<http://schemas.android.com/tools>">
    <!-- Base application theme. -->
  <style name="Theme.VYou" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
  <item name="colorPrimary">@color/purple_500</item>
        <item name="colorPrimaryVariant">@color/purple_700</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
  <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
  <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
        <!-- Customize your theme here. -->
  </style>
</resources>

but everything that’s configurable via theme.xml will also change the display inside the SDK.

Scroll to Top