TrustVision SDK is the android SDK for TrustVision Engine. This document is for Clients who only use the UI of the SDK. It provides these features:
tv_sdk.zip
, extract and put all files into a folder in android project.
Example: folder ${project.rootDir}/repo
app
root
repo
+--com
+--trustvision
+--tv_api_sdk
+--3.x.x
+--tv_api_sdk-3.x.x.aar
+--tv_api_sdk-3.x.x.pom
maven-metadata.xml
+--tv_core_sdk
+--tv_sdk
...
build.gradle
buildscript {
ext.kotlin_version = '1.6.21' // or any version that >= 1.5 and < 1.8
repositories {
maven {
url 'https://maven.google.com'
}
mavenCentral()
google()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "path/to/tvsdk/folder" } // example : maven { url "${project.rootDir}/repo" }
...
}
}
Note : If your project uses the new way to define repositories (central declaration of repositories), you must change repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
to repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
google()
mavenCentral()
}
}
app/build.gradle
android {
...
aaptOptions {
noCompress "tflite"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.trustvision:tv_sdk:3.x.x@aar') {
transitive = true
}
testImplementation 'junit:junit:4.12'
}
To initialize the SDK, add the following lines to your app, and it needs to be completed successfully before calling any other SDK functionalities.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TrustVisionSDK.init(jsonConfigurationByServer, languageCode, tvTheme);
}
Please note: The SDK requires Camera permissions to capture images. Camera permissions will be handled by the SDK if not already handled by the app.
where:
String
. The jsonConfigurationByServer is optional but recommended.
It's the setting specialized for each client from TS server.
It's the response json string get by
API https://ekyc.trustingsocial.com/api-reference/customer-api/#get-client-settings.
When it's null or unmatched with the expected type then the default setting in the SDK will be used.String
the code of the language that will show and sound to user. E.g Vietnamese (vi), English (
en).TVTheme
. UI customization theme. Use to customize the SDK's UI.TrustVisionSdk.getSupportedLanguages();
TrustVisionSdk.getLanguageCode();
Allow user to change the sdk language after initialization
TrustVisionSdk.changeLanguageCode(String languageCode);
The SDK provides some built in Activities example activity to capture id, selfie, liveness...
The id capturing activity will show the camera to capture image, preview the image. To start the id capturing activity.
TVIDConfiguration.Builder builder=new TVIDConfiguration.Builder()
.setCardType(selectedCard)
.setCardSide(TVSDKConfiguration.TVCardSide.FRONT)
.setReadBothSide(false)
.setEnableSound(false)
.setEnablePhotoGalleryPicker(false)
.setEnableTiltChecking(false)
.setSkipConfirmScreen(false)
.setEnableScanNFC(true)
.setEnableScanQr(true);
TVIDConfiguration configuration=builder.build();
Options:
TVCardType
. List of supported cards can be found by TrustVisionSDK.getCardTypes()
if you set jsonConfigurationByServer when init SDK.
If not, use :new TVCardType(
"vn.national_id",
"CMND cũ / CMND mới / CCCD",
true,
TVCardType.TVCardOrientation.HORIZONTAL
);
TVCardSide
. Card side to capture.boolean
. If true then the sdk will capture both side if possible; otherwise, then the card side
defined in cardSide will be used.boolean
. Sound should be played or not.boolean
. Allow user select id card image from phone gallery.boolean
. Check if the phone is parallel to the ground before taking the id card photo or
not.boolean
. Control whether the SDK should skip the confirmation screen.boolean
. scan NFC chip of the id card or not.boolean
. scan QR code of the id card or not.TrustVisionSDK.startIDCapturing(context, configuration, new TVCapturingCallBack(){
@Override
public void onNewFrameBatch(FrameBatch frameBatch){
}
@Override
public void onError(TVDetectionError error){
}
@Override
public void onSuccess(TVDetectionResult result){
}
@Override
public void onCanceled(){
}
@Override
public String readIdCardNumber(@NonNull TVImageClass image) {
}
});
where:
TVCapturingCallBack
. It is an interface that has 3 methodsNewFrameBatchCallback
. can be called multiple times during the capturing to return frame
data.FrameBatch
String
. batch id generated by TV SDKList<TVFrameClass>
. batch frame to pushMap<String, String>
. batch metadata to pushSet<String>
. For debugging purpose onlyonSuccess
method has one parameter.TVDetectionResult
. has the following methods:ErrorCallback
. Will be called when an error has occurred during the capturing.TVDetectionError
CancellationCallback
. Will be called when the journey has been cancelled (e.g user clicked on
back button...)TVImageClass
. image of back id cardWith each batch that returned by onNewFrameBatch(FrameBatch)
callback,
call the below api to upload the data to server, and store the frame batch id that responses from the API, keep it
corresponding with frameBatch.getId()
- local id
https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-frame-batch
For example:
// this dictionary will be used for ID Tampering Verification
Map frontCardFrameBatchIdsDictionary = new HashMap<String, String>();
Map backCardFrameBatchIdsDictionary = new HashMap<String, String>();
// frameBatchIdsDictionary.put(
// key = <id_returned_from_sdk>,
// value = <id_responded_from_server>
// );
@Override
public void onNewFrameBatch(FrameBatch frameBatch) {
Gson gson = new Gson();
String framesStr = gson.toJson(frameBatch.getFrames());
Map<String, Object> params = new HashMap<>();
params.put("frames", framesStr);
params.put("metadata", frameBatch.getMetadata());
params.put("label", "video");
String jsonToBeUploaded=gson.toJson(map);
// upload frame batch to server using this api:
// https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes
YourResponseObject uploadingResult = yourMethodToUploadFrameBatch(jsonToBeUploaded);
// Keep the id that generated by the SDK corresponding with the one responded from server
if (cardSide == TVSDKConfiguration.TVCardSide.FRONT) {
frontCardFrameBatchIdsDictionary.put(
key = frameBatch.batchId,
value = uploadingResult.fileId
);
} else {
backCardFrameBatchIdsDictionary.put(
key = frameBatch.batchId,
value = uploadingResult.fileId
);
}
}
// These lists contain all valid frame batch ids that responded by server
List<String> validFrontCardServerFrameBatchIds;
List<String> validBackCardServerFrameBatchIds;
@Override
public void onSuccess(TVDetectionResult result){
// the batch id list is null when Frame Recording feature is disabled by client settings.
// Wait until every Frame batch has been uploaded to server before calling this
if (everyFrameBatchUploadingCompleted) {
if (result.frontCardFrameBatchIds != null) {
validFrontCardServerFrameBatchIds = removeRedudantFrameBatchIds(frontCardFrameBatchIdsDictionary, result.frontCardFrameBatchIds);
}
if (result.backCardFrameBatchIds != null) {
validBackCardServerFrameBatchIds = removeRedudantFrameBatchIds(backCardFrameBatchIdsDictionary, result.backCardFrameBatchIds);
}
}
}
private List<String> removeRedudantFrameBatchIds(Map<String, String> batchIdsDictionary, Set<String> validIdsFromSDK){
Iterator<Map.Entry<String, String>> iter = batchIdsDictionary.entrySet().iterator();
while(iter.hasNext()) {
Map.Entry<String, String> entry=iter.next();
if(!validIdsFromSDK.contains(entry.getKey())){
iter.remove();
}
}
return batchIdsDictionary.values();
}
Use this API https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image The images should be uploaded as JPEG data with 100% quality. For example:
String frontCardId;
String backCardId;
String qrId;
@Override
public void onSuccess(TVDetectionResult result) {
// With front side
if (result.getFrontCardImage() && result.getFrontCardImage().getImageByteArray() != null){
byte[] frontImageData = result.getFrontCardImage().getImageByteArray();
frontCardId = yourMethodToUploadImage(frontImageData);
}
// With back side
if (result.getBackCardImage() && result.getBackCardImage().getImageByteArray() != null) {
byte[] backImageData = result.getBackCardImage().getImageByteArray();
backCardId = yourMethodToUploadImage(backImageData);
}
// In case the QR capturing feature is enabled, and `result.getCardQrImage()` is null then
// the user will be notified, so they can choose to re-capture their ID card.
if (result.getCardQrImage() && result.getCardQrImage().getImageByteArray() != null) {
byte[] qrImageData = result.getCardQrImage().getImageByteArray();
qrId = yourMethodToUploadImage(qrImageData);
}
}
Call this API https://ekyc.trustingsocial.com/api-reference/customer-api/#request-detect-id-card-tampering with params:
{
"image": {
"id": "<frontCardId>"
},
"image2": {
"id": "<backCardId>"
},
"qr1_images": [
{
"id": "<qrId>"
}
],
"card_type": "<result.cardType.getCardId()>",
"videos": [
{
"id": "<validFrontCardServerFrameBatchIds.get(index)>"
},
{
"id": "<validFrontCardServerFrameBatchIds.get(index + 1)>"
},
...
{
"id": "<validBackCardServerFrameBatchIds.get(index)>"
},
{
"id": "<validBackCardServerFrameBatchIds.get(index + 1)>"
},
...
]
}
if result.getFrontIdQr().isRequired()
is true then result.getFrontIdQr().getImages()
array should be non-empty. Otherwise, clients should be warned to re-capture id card photos.
QR images will be uploaded with this api: https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image
String metadata = result.getFrontIdQr().getImages().get(i).getMetadata();
String label = result.getFrontIdQr().getImages().get(i).getLabel();
byte[] data = result.getFrontIdQr().getImages().get(i).getImageByteArray();
*The same logic will be applied to result.getBackIdQr()
After capture the back card, if the card has nfc chip, SDK will call readIdCardNumber
method in background thread. With image that returned by readIdCardNumber
,
call api to detect id number of the card then return id number to start flow scan NFC. If id number is null or empty, SDK skip flow scan NFC and continue
@Override
public void readIdCardNumber(TVImageClass image) {
String idNumber = "";
// call api or do any thing to read and return id number
// TODO
return idNumber;
}
The selfie capturing activity will show the camera to capture image, preview the image, verify liveness. To start the selfie capturing activity.
TVSelfieConfiguration.Builder builder = new TVSelfieConfiguration.Builder()
.setCameraOption(TVSDKConfiguration.TVCameraOption.FRONT)
.setEnableSound(false)
.setLivenessMode(TVLivenessMode.PASSIVE)
.setSkipConfirmScreen(false);
Options:
TVCameraOption
. Camera modeboolean
. Sound should be played or notTVLivenessMode
. Liveness verification modeboolean
. Control whether the SDK should skip the confirmation screen.TrustVisionSDK.startSelfieCapturing(context, languageCode, builder.build(), new TVCapturingCallBack() {
@Override
public void onNewFrameBatch(FrameBatch frameBatch) {
}
@Override
public void onError(TVDetectionError error) {
}
@Override
public void onSuccess(TVDetectionResult result) {
}
@Override
public void onCanceled(){
}
});
where:
TVCapturingCallBack
. It is an interface that has 3 methodsNewFrameBatchCallback
. can be called multiple times during the capturing to return frame
data.FrameBatch
String
. batch id generated by TV SDKList<TVFrameClass>
. batch frame to pushMap<String, String>
. batch metadata to pushSet<String>
. For debugging purpose onlyonSuccess
method has one parameter.TVDetectionResult
. has the following methods:ErrorCallback
. Will be called when an error has occurred during the capturing.TVDetectionError
CancellationCallback
. Will be called when the journey has been cancelled (e.g user clicked on
back button...)With each batch that returned by onNewFrameBatch(FrameBatch)
callback,
call the below api to upload the data to server, and store the frame batch id that responses from the API, keep it
corresponding with frameBatch.getId()
- local id
https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-frame-batch
For example:
// this dictionary will be used for Liveness verification
Map selfieFrameBatchIdsDictionary = new HashMap<String, String>();
// frameBatchIdsDictionary.put(
// key = <id_returned_from_sdk>,
// value = <id_responded_from_server>
// );
@Override
public void onNewFrameBatch(FrameBatch frameBatch) {
Gson gson = new Gson();
String framesStr = gson.toJson(frameBatch.getFrames());
Map<String, Object> params = new HashMap<>();
params.put("frames", framesStr);
params.put("metadata", frameBatch.getMetadata());
params.put("label", "video");
String jsonToBeUploaded = gson.toJson(map);
// upload frame batch to server using this api:
// https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes
YourResponseObject uploadingResult = yourMethodToUploadFrameBatch(jsonToBeUploaded);
// Keep the id that generated by the SDK corresponding with the one responded from server
frameBatchIdsDictionary.put(
key = frameBatch.batchId,
value = uploadingResult.fileId
);
}
// This list contains all valid frame batch ids that responded by server
List<String> validServerFrameBatchIds;
@Override
public void onSuccess(TVDetectionResult result) {
// result.selfieFrameBatchIds is null when Frame Recording feature is disabled by client settings.
// Wait until every Frame batch has been uploaded to server before calling this
if (everyFrameBatchUploadingCompleted) {
if (result.selfieFrameBatchIds != null) {
validServerFrameBatchIds = removeRedudantFrameBatchIds(selfieFrameBatchIdsDictionary, result.selfieFrameBatchIds);
}
}
}
private List<String> removeRedudantFrameBatchIds(Map<String, String> batchIdsDictionary, Set<String> validIdsFromSDK) {
Iterator<Map.Entry<String, String>> iter = batchIdsDictionary.entrySet().iterator();
while(iter.hasNext()) {
Map.Entry<String, String> entry = iter.next();
if (!validIdsFromSDK.contains(entry.getKey())) {
iter.remove();
}
}
return batchIdsDictionary.values();
}
Use this api https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image
to get image ids with the inputs are the elements of result.getSelfieImages()
The images should be uploaded as JPEG data with 100% quality.
For example:
// These lists of image ids will be used in Liveness Verification
List<String> frontalImageIds = new ArrayList<>();
List<String> gestureImageIds = new ArrayList<>();
@Override
public void onSuccess(TVDetectionResult result) {
handleSelfieImages(result.getSelfieImages());
}
private void handleSelfieImages(List<SelfieImage> selfieImages) {
for (selfieImage: selfieImages) {
// Handle frontal images
if (selfieImage.getFrontalImage() != null && selfieImage.getFrontalImage().getImageByteArray() != null){
byte[] frontalImageByteArray = selfieImage.getFrontalImage().getImageByteArray();
// frontalImageId is the id of the image, returned from server when the uploading API is completed successfully
String frontalImageId = yourUploadImageMethod(frontalImageByteArray);
frontalImageIds.add(frontalImageId);
}
// Handle gesture images
if (selfieImage.getGestureImage() != null && selfieImage.getGestureImage().getImageByteArray() != null){
byte[] gestureImageByteArray = selfieImage.getGestureImage().getImageByteArray();
// gestureImageId is the id of the image, returned from server when the uploading API is completed successfully
String gestureImageId = yourUploadImageMethod(gestureImageByteArray);
gestureImageIds.add(gestureImageId);
}
}
}
Upload Image API request, parameters:
{
"file": "<byte[] dataToUpload>",
"label": "<proper label, check the API document for detail>"
}
API document: https://ekyc.trustingsocial.com/api-reference/customer-api/#verify-face-liveness
Call the above api with below parameters:
images
field{
"images": [
{
"id": "<frontalImageIds.get(index)>"
},
{
"id": "<frontalImageIds.get(index + 1)>"
},
...
]
}
gesture_images
field{
"gesture_images": [
{
"gesture": "<result.getSelfieImages().get(index).getGestureType().toGestureType().toLowerCase()>",
"images": [
{
"id": "<gestureImageIds.get(index)>"
}
]
},
{
"gesture": "<result.getSelfieImages().get(index + 1).getGestureType().toGestureType().toLowerCase()>",
"images": [
{
"id": "<gestureImageIds.get(index + 1)>"
}
]
},
...
]
}
videos
field{
"videos": [
{
"id": "<validServerFrameBatchIds.get(index)>"
},
{
"id": "<validServerFrameBatchIds.get(index + 1)>"
},
...
]
}
metadata
field{
"metadata": "<result.getLivenessMetadata()>"
}
// [FlowStartingFunc]: startIdCapturing, startSelfieCapturing
TrustVisionSDK.[FlowStartingFunc](..., builder.build(), new TVCapturingCallBack() {
@Override
public void onError(TVDetectionError error) {
String message = error.getErrorDescription();
Log.d("", message);
showToast(message);
///////////////////////////////////////
// ERROR HANDLER
int code = error.getErrorCode();
String description = error.getErrorDescription();
switch code {
case TVDetectionError.DETECTION_ERROR_PERMISSION_MISSING:
// No camera permission.
case TVDetectionError.DETECTION_ERROR_CAMERA_ERROR:
// The camera can't be opened.
case TVDetectionError.DETECTION_ERROR_SDK_INTERNAL:
// The SDK has an unexpected error.
}
}
@Override
public void onSuccess(TVDetectionResult result) {
}
@Override
public void onCanceled() {
}
});
The SDK provides some built-in API for quick detection
Allow users to quick check if device support NFC so that they can determine for their next step
TrustVisionSDK.isNfcSupport(Context): Boolean
Method | Type | description |
---|---|---|
isLive | Boolean | Determines whether the selfie is live or not |
getScore() | float | The score from 0 to 1 |
Method | Type | description |
---|---|---|
getSelfieImages() | List<SelfieImage > | List of images that each item contains the bitmap of the selfie image |
getSelfieFrameBatchIds() | Final list of Selfie's local frame batch IDs. Local batch ids that not in this list are invalid and their corresponding server IDs shouldn't be used | |
getLivenessMetadata() | JSONObject | Collected data during liveness checking process |
Method | Type | description |
---|---|---|
getFrontCardImage() | TVImageClass | Contains bitmap of the front image |
getBackCardImage() | TVImageClass | Contains bitmap of the back image |
getQRImage() | TVImageClass | Contains bitmap of the QR image |
getFrontCardFrameBatchIds() | Set<String > | Final list of front side's local frame batch IDs. Local batch ids that not in this list are invalid and their corresponding server IDs shouldn't be used |
getBackCardFrameBatchIds() | Set<String > | Final list of back side's local frame batch IDs. Local batch ids that not in this list are invalid and their corresponding server IDs shouldn't be used |
getNfcInfoResult() | TVNfcInfoResult | Contains info from nfc chip. Use it to call api verify NFC |
Method | Type | description |
---|---|---|
getError() | TVDetectionError | The error found when doing any detection |
Method | Type | description |
---|---|---|
getGestureType() | FaceDetectionType | Gesture type of the selfie image |
getFrontalImage() | TVImageClass | Frontal image of the selfie image |
getGestureImage() | TVImageClass | Gesture image of the selfie image |
Method | Type | description |
---|---|---|
getType() | int | Represent a gesture type |
int NEUTRAL = 1
int TURN_LEFT = 5
int TURN_RIGHT = 6
int FACE_UP = 7
int FACE_DOWN = 8
Method | Type | description |
---|---|---|
getLabel() | String | Label of the Image class. |
getImage() | Bitmap | Captured Bitmap |
Method | Type | description |
---|---|---|
getErrorCode() | int | Error code |
getErrorDescription() | String | Error description |
Error code is one of the below list
int TVDetectionError.DETECTION_ERROR_PERMISSION_MISSING = 1004
int TVDetectionError.DETECTION_ERROR_CAMERA_ERROR = 1005
int TVDetectionError.DETECTION_ERROR_SDK_INTERNAL = 1007
Method | Type | description |
---|---|---|
getFrames() | List<TVFrameClass > | Recorded frames during the capturing |
getId() | String | Local ID of the batch, to be corresponds with the ID responded from server after the frame batch is pushed |
getMetadata() | Map<String, String> | Metadata of the batch |
getValidVideoIds() | Set <String > | For debugging purpose only |
Method | Type | description |
---|---|---|
getFramesBase64() | String | The data of the frame as a base64 String |
getIndex() | String | Index of this frame in the list of recorded frames |
getLabel() | String | Label of this frame |
Will be called in case failed. Parameters:
TVDetectionError
.Will be called in case the sdk is cancelled. No parameters.
Method | Type | Description |
---|---|---|
getCom() | String | |
getSod() | String | |
getDg1() | String | |
getDg2() | String | |
getDg13() | String | |
getDg14() | String | |
getDg15() | String | |
getCloneStatus() | TVNfcVerificationStatus |
Method | Type | Description |
---|---|---|
getError() | TVDetectionError | |
getVerdict() | TVNfcVerdict | TVNfcVerdict.NOT_CHECKED TVNfcVerdict.ALERT TVNfcVerdict.GOOD TVNfcVerdict.ERROR |
This document introduces how to enable the ability to customize UI components of TrustingVision SDK.
Check out the default UI of TrustingVision SDK. We provide you the ability to change and modify many UI components: background colors, font interfaces, font sizes, icons, buttons.
Initialize and change properties of TVTheme
class. If any of which is not set, it will get default value.
After that, input the instance of TVTheme
as a parameter of the TV SDK's initialization method. See Initialize TV SDK
TVTheme
let you custom and override attributes, which includes:
Properties/Functions | Type | Description |
---|---|---|
idCapturingTheme | TVIdCapturingTheme | Attributes that change the UI of ID Card Detection screen. |
idConfirmationTheme | TVIdConfirmationTheme | Attributes that change the UI of ID Confirmation screen. |
selfieCapturingTheme | TVSelfieCapturingTheme | Attributes that change the UI of Selfie Capturing screen. |
selfieConfirmationTheme | TVSelfieConfirmationTheme | Attributes that change the UI of Selfie Confirmation screen. |
qrGuidelinePopupTheme | TVQrPopupTheme | Modifying UI of QR guideline popup. |
qrRetryPopupTheme | TVQrPopupTheme | Modifying UI of QR retry popup. |
clone() | () -> TVTheme | A function that returns a deep copy of TVTheme 's instance itself. |
Object TVThemeDefaultValues
helps you to quickly change some common UI components that will be used across the whole SDK.
In case a specific Screen's theme is set, it will override TVThemeDefaultValues
's properties.
Properties | Type | Description |
---|---|---|
normalLabelTheme | TVLabelTheme | Normal text of SDK. |
titleLabelTheme | TVLabelTheme | The title of every screen (located on the top-most, centered of screen). |
errorLabelTheme | TVLabelTheme | This text is shown as if any user misconduction or system failure occurred during the detection process. |
instructionLabelTheme | TVLabelTheme | Instruction text. |
timeoutLabelTheme | TVLabelTheme | The count down text. |
The object TVLabelTheme
can be described in this table below:
Properties/Functions | Type | Label's |
---|---|---|
font | Typeface | font family and style |
textSize | Float | text size |
textColor | @ColorInt Int | text color |
textGravity | Int | text alignment of its frame. E.g Gravity.Center, Gravity.Start... |
backgroundColors | [@ColorInt Int] | background colors. If total elements of this array is >= 2, the background color is gradient, else it'd be solid. |
isBackgroundGradientHorizontal | Boolean | background gradient direction |
cornerRadius | Float | rounded corner |
isHidden | Boolean | hide the label |
borderWidth | Float | border width |
borderColor | @ColorInt Int | border color |
clone() | () -> TVLabelTheme | A function that returns a deep copy of TVLabelTheme 's instance itself. |
Here is a snipped code example:
private void customizeTVCommonThemes() {
// Common Title label theme
TVLabelTheme titleLabelThemeDefault = TVThemeDefaultValues.getTitleLabelTheme();
titleLabelThemeDefault.setFont(your_font);
// there are more to be customized...
// Common Normal label theme
TVLabelTheme normalLabelThemeDefault = TVThemeDefaultValues.getNormalLabelTheme();
normalLabelThemeDefault.setTextSize(your_text_size);
// there are more to be customized...
// Common Instruction label theme
TVLabelTheme instructionLabelTheme = TVThemeDefaultValues.getInstructionLabelTheme();
instructionLabelTheme.setTextColor(your_text_color);
// there are more to be customized...
// Common Error label theme
TVLabelTheme errorLabelThemeDefault = TVThemeDefaultValues.getErrorLabelTheme();
errorLabelThemeDefault.setCornerRadius(your_corner_radius);
// there are more to be customized...
// Common Timeout label theme
TVLabelTheme timeoutLabelThemeDefault = TVThemeDefaultValues.getTimeoutLabelTheme();
timeoutLabelThemeDefault.setBackgroundColors(your_background_colors);
// there are more to be customized...
}
Class TVIdCapturingTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
instructionLabelTheme | TVLabelTheme | |
errorLabelTheme | TVLabelTheme | |
timeoutLabelTheme | TVLabelTheme | |
normalLabelTheme | TVLabelTheme | |
qrInstructionLabelTheme | TVLabelTheme | The instruction text that show during QR scanning process. |
closeButtonLocation | enumTVButtonLocation | The position of close button to device orientation: .TOP_LEFT : to the left of the title .TOP_RIGHT : to the right of the title .NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | @ColorInt Int | Background color of the screen. Default value is black with 60% opacity. |
captureButtonImage | Bitmap | The image of the capture button. |
captureButtonDisableImage | Bitmap | The image of the disabled capture button. |
closeButtonImage | Bitmap | The image of the close view button. |
maskViewNeutralImage | Bitmap | The mask image of camera view when start the ID Capture flow. |
maskViewSuccessImage | Bitmap | The mask image of camera view when detected a valid ID card. |
maskViewErrorImage | Bitmap | The mask image of camera view when cannot detect any ID card. |
qrInstructionBackgroundImage | Bitmap | The image behind the QR instruction text. |
qrMaskViewNeutralImage | Bitmap | The mask image of camera view when start QR detection or not detected any QR code. |
qrMaskViewSuccessImage | Bitmap | The mask image of camera view when detected a valid QR code. |
qrMaskViewErrorImage | Bitmap | The mask image of camera view when detected an invalid QR code. |
loadingImage | Bitmap | Loading indicator in image. |
clone() | () -> TVIdCapturingTheme | A function that returns a deep copy of TVIdCapturingTheme 's instance itself. |
Class TVIdConfirmationTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
errorLabelTheme | TVLabelTheme | |
normalLabelTheme | TVLabelTheme | |
closeButtonLocation | enumTVButtonLocation | The position of close button to device orientation: .TOP_LEFT : to the left of the title .TOP_RIGHT : to the right of the title .NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | @ColorInt Int | Background color of the screen. Default value is black with 60% opacity. |
closeButtonImage | Bitmap | The image of the close view button. |
confirmButtonImage | Bitmap | The image of the "Look good" button. |
retryButtonImage | Bitmap | The image of the "Try again" button. |
icQrResultSuccessImage | Bitmap | Icon before text that scanned QR successfully. |
icQrResultErrorImage | Bitmap | Icon before text that scanned QR failed. |
maskViewImage | Bitmap | The mask image of camera view showing captured image. |
loadingImage | Bitmap | Loading indicator in image. |
clone() | () -> TVIdConfirmationTheme | A function that returns a deep copy of TVIdConfirmationTheme 's instance itself. |
Class TVSelfieCapturingTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
instructionLabelTheme | TVLabelTheme | |
errorLabelTheme | TVLabelTheme | |
timeoutLabelTheme | TVLabelTheme | |
normalLabelTheme | TVLabelTheme | |
closeButtonLocation | enumTVButtonLocation | The position of close button to device orientation: .TOP_LEFT : to the left of the title .TOP_RIGHT : to the right of the title .NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | @ColorInt Int | Background color of the screen. Default value is black with 60% opacity. |
captureButtonImage | Bitmap | The image of the capture button. |
captureButtonDisableImage | Bitmap | The image of the disabled capture button. |
closeButtonImage | Bitmap | The image of the close view button. |
switchCameraSideImage | Bitmap | The image of switch camera button. |
maskViewNeutralImage | Bitmap | The mask image of camera view when start the selfie flow. |
maskViewSuccessImage | Bitmap | The mask image of camera view when detected a valid face. |
maskViewErrorImage | Bitmap | The mask image of camera view when cannot detect any valid face. |
progressTheme.isHidden | Boolean | Hide the current 4 steps view. |
progressTheme.backgroundColor | @ColorInt Int | Background color of the circle progress theme. |
progressTheme.progressColor | @ColorInt Int | Background color of the progress steps. |
gestureTheme.isHidden | Boolean | Whether of not should hide selfie steps' group view. |
gestureTheme.turnLeftActiveImage | Bitmap | Image for turn left step gesture when active. |
gestureTheme.turnRightActiveImage | Bitmap | Image for turn right step gesture when active. |
gestureTheme.turnUpActiveImage | Bitmap | Image for turn up step gesture when active. |
gestureTheme.turnDownActiveImage | Bitmap | Image for turn down step gesture when active. |
gestureTheme.lookStraightActiveImage | Bitmap | Image for look straight step gesture when active. |
gestureTheme.turnLeftInactiveImage | Bitmap | Image for turn left step gesture when inactive. |
gestureTheme.turnRightInactiveImage | Bitmap | Image for turn right step gesture when inactive. |
gestureTheme.turnUpInactiveImage | Bitmap | Image for turn up step gesture when inactive. |
gestureTheme.turnDownInactiveImage | Bitmap | Image for turn down step gesture when inactive. |
gestureTheme.lookStraightInactiveImage | Bitmap | Image for look straight step gesture when inactive. |
gestureTheme.finishedGestureBackgroundImage | Bitmap | Background for every step that completed. |
gestureTheme.currentStepFocusImage | Bitmap | Image overlay for current step indicator. |
maskViewErrorImage | Bitmap | The mask image of camera view when cannot detect any valid face. |
maskViewErrorImage | Bitmap | The mask image of camera view when cannot detect any valid face. |
loadingImage | Bitmap | Loading indicator in image. |
clone() | () -> TVSelfieCapturingTheme | A function that returns a deep copy of TVSelfieCapturingTheme 's instance itself. |
Class TVSelfieConfirmationTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
normalLabelTheme | TVLabelTheme | |
closeButtonLocation | enumTVButtonLocation | The position of close button to device orientation: .TOP_LEFT : to the left of the title .TOP_RIGHT : to the right of the title .NONE : hide the button |
showTrademark | Boolean | Show the trademark text or not. |
backgroundColor | @ColorInt Int | Background color of the screen. Default value is black with 60% opacity. |
closeButtonImage | Bitmap | The image of the close view button. |
maskViewImage | Bitmap | The mask image of selfie captured image. |
loadingImage | Bitmap | Loading indicator in image. |
clone() | () -> TVSelfieConfirmationTheme | A function that returns a deep copy of TVSelfieConfirmationTheme 's instance itself. |
Class TVQrPopupTheme
If a property is not set then the default value will be used.
Properties/Functions | Type | Description |
---|---|---|
titleLabelTheme | TVLabelTheme | See Common UI components section. |
descriptionTheme | TVLabelTheme | Theme of description text. |
primaryButtonTheme | TVLabelTheme | Theme of the main button of popup. |
secondaryButtonTheme | TVLabelTheme | Theme of sub-button of popup. |
timeoutLabelTheme | TVLabelTheme | Theme of timeout-warning text. |
backgroundColor | @ColorInt Int | Background color of the view. |
clone() | () -> TVQrPopupTheme | A function that returns a deep copy of TVQrPopupTheme 's instance itself. |
Here is a snipped code example:
private TVTheme initTVTheme() {
TVTheme customizedTheme = new TVTheme();
// Selfie capturing screen
customizedTheme.getSelfieCapturingTheme().getGestureTheme().setLookStraightActiveImage(your_image);
// there are more to be customized...
// Selfie confirmation screen
customizedTheme.getSelfieConfirmationTheme().setRetryButtonImage(your_image);
// there are more to be customized...
// Id capturing screen
customizedTheme.getIdCapturingTheme().setMaskViewNeutralImage(your_image);
// there are more to be customized...
// Id confirmation screen
customizedTheme.getIdConfirmationTheme().setCloseButtonImage(your_image);
// there are more to be customized...
// QR guideline popup
customizedTheme.getQrGuidelinePopupTheme().setHeaderImage(your_image);
// there are more to be customized...
// QR guideline popup
customizedTheme.getQrRetryPopupTheme().setBackgroundColor(your_color);
// there are more to be customized...
return customizedTheme;
}