Card


Currently, we have new version of the SDK available. (Click to see more information)

1.5.1 🚀 Latest

The Card library allows you to capture the user's card ID. This library depends of your user case and is optional.

Contact to support for obtain the step for register in AKCore class.

Quick start


Add card as a dependency in your build.gradle app.

build.gradle:app
implementation 'com.autentikar:card:1.5.1'

Set up


Initialize SDK

Before continuing, you can set up the SDK with the following code, we recommend that you do this in the Application class:

Kotlin
import com.autentikar.core.init.AKCore
import com.autentikar.core.data.types.AKStepType
import com.autentikar.cardcapture.ui.view.AKStepCardActivity
import com.autentikar.cardcapture.init.AKCardCapture

// version 1.4.8 and below
AKCore.register(AKStepCardActivity(), AKStepType.yourStepProvidedBySupport)

// version 1.5.0 and above
AKCore.register(AKCardCapture.getProtocol(AKStepType.yourStepProvidedBySupport))
Java
import com.autentikar.core.init.AKCore;
import com.autentikar.core.data.types.AKStepType;
import com.autentikar.cardcapture.ui.view.AKStepCardActivity;
import com.autentikar.cardcapture.init.AKCardCapture;

// version 1.4.8 and below
AKCore.register(new AKStepCardActivity(), AKStepType.yourStepProvidedBySupport);

// version 1.5.0 and above
AKCore.register(AKCardCapture.getProtocol(AKStepType.yourStepProvidedBySupport));

This will register the AKCardCapture in the AKCore class. This activity will be used to capture the card of the user, is mandatory to register this activity in the AKCore class.

Custom Theme


If you want to customize the theme of the AKCardCapture you can to call AKCardCaptureCustomization() functions for setting:

  • Button: change theme of the button.
  • LoadingScreen: change theme of the loading screen.
  • captureScreen: change theme of the capture screen.
Kotlin
import com.autentikar.cardcapture.init.AKCardCapture
import com.autentikar.cardcapture.ui.customization.AKCardCaptureCustomization

private fun autentikarCustomUI() {
  val cardCustomization = AKCardCaptureCustomization()
  val button = AKCardCaptureCustomization.Button()
  val loadingScreen = AKCardCaptureCustomization.LoadingScreen()
  val captureScreen = AKCardCaptureCustomization.CaptureScreen()

  cardCustomization.backgroundColor = Color.parse("#your_background_color")
  cardCustomization.showBackgroundImage = true | false
  cardCustomization.backgroundImage = R.drawable.your_background_image
  cardCustomization.cardRecapture = R.drawable.your_icon_recapture
  cardCustomization.textColor = Color.parse("#your_text_color")
  cardCustomization.showExitButton = true | false
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    cardCustomization.customFontTypeface = resources.getFont(R.font.your_custom_font)
    cardCustomization.customFontTypeface = resources.getFont(R.font.your_custom_font)
  } else {
    cardCustomization.customFontTypeface = your_custom_font_typeface // example: ResourcesCompat.getFont(this, R.font.yout_font)
    cardCustomization.customHeaderFontTypeface = your_custom_font_typeface // example: ResourcesCompat.getFont(this, R.font.yout_font)
  }

  cardCustomization.alertStyle = R.style.AlertDialogCustom

  // Button

  button.backgroundColor = Color.parse("#your_background_color")
  button.textColor = Color.parse("#your_text_color")
  button.textSecondaryColor = Color.parse("#your_text_secondary_color")
  button.disableTextColor = Color.parse("#your_disable_text_color")
  button.disableBackgroundColor = Color.parse("#your_disable_background_color")
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    button.customFontTypeface = resources.getFont(R.font.your_custom_font)
  } else {
    button.customFontTypeface = your_custom_font_typeface // example: ResourcesCompat.getFont(this, R.font.yout_font)
  }
  button.textSize = 25f

  // Loading Screen
      
  loadingScreen.backgroundColor = Color.parse("#your_background_color")
  loadingScreen.showBackgroundImage = true | false
  loadingScreen.backgroundImage = R.drawable.your_background_image
  loadingScreen.showLogo = true | false
  loadingScreen.logo = R.drawable.your_logo
  loadingScreen.progressBarColor = Color.parse("#your_progress_bar_color")
  loadingScreen.textColor = Color.parse("#your_text_color")

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    loadingScreen.customFontTypeface = resources.getFont(R.font.your_custom_font)
  } else {
    loadingScreen.customFontTypeface = your_custom_font_typeface // example: ResourcesCompat.getFont(this, R.font.yout_font)
  }

  // Capture Screen
      
  captureScreen.referenceFrame = R.drawable.your_reference_frame
  captureScreen.closeImage = R.drawable.your_close_image

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    captureScreen.customFontTypeface = resources.getFont(R.font.your_custom_font)
  } else {
    captureScreen.customFontTypeface = your_custom_font_typeface // example: ResourcesCompat.getFont(this, R.font.yout_font)
  }
      
  cardCustomization.buttonCustomization = button
  cardCustomization.loadingScreenCustomization = loadingScreen
  cardCustomization.captureScreenCustomization = captureScreen
      
  AKCardCapture.setCustomization(cardCustomization)
}
Java

import com.autentikar.cardcapture.init.AKCardCapture;
import com.autentikar.cardcapture.ui.customization.AKCardCaptureCustomization;

private void autentikarCustomUI() {

  AKCardCaptureCustomization cardCustomization = new AKCardCaptureCustomization();
  AKCardCaptureCustomization.Button button = new AKCardCaptureCustomization.Button();
  AKCardCaptureCustomization.LoadingScreen loadingScreen = new AKCardCaptureCustomization.LoadingScreen();
  AKCardCaptureCustomization.CaptureScreen captureScreen = new AKCardCaptureCustomization.CaptureScreen();

  cardCustomization.setBackgroundColor(your_background_color);
  cardCustomization.setShowBackgroundImage(true | false);
  cardCustomization.setBackgroundImage(R.drawable.your_background_image);
  cardCustomization.setTextColor(your_text_color);
  cardCustomization.setCardRecapture(R.drawable.your_icon_recapture);
  cardCustomization.setShowExitButton(true | false);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
   cardCustomization.setCustomFontTypeface(getResources().getFont(R.font.your_custom_font));
   cardCustomization.setCustomHeaderFontTypeface(getResources().getFont(R.font.your_custom_font));
  } else {
  cardCustomization.setCustomFontTypeface(Typeface.createFromAsset(getAssets(), "fonts/your_custom_font.ttf")); // example: Typeface.createFromAsset(assets, "fonts/your_custom_font.ttf")
  cardCustomization.setCustomHeaderFontTypeface(Typeface.createFromAsset(getAssets(), "fonts/your_custom_font.ttf"));
  }
  cardCustomization.setAlertStyle(R.style.your_alert_style);

  // Button

  button.setBackgroundColor(your_background_color);
  button.setTextColor(your_text_color);
  button.setTextSecondaryColor(your_text_secondary_color);
  button.setDisableBackgroundColor(your_disable_background_color);
  button.setDisableTextColor(your_disable_text_color);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
   button.setCustomFontTypeface(getResources().getFont(R.font.your_custom_font));
  } else {
  button.setCustomFontTypeface(Typeface.createFromAsset(getAssets(), "fonts/your_custom_font.ttf")); // example: Typeface.createFromAsset(assets, "fonts/your_custom_font.ttf")
  }
  button.setTextSize(25f);

  // Loading Screen

  loadingScreen.setBackgroundColor(your_background_color);
  loadingScreen.setTextColor(your_text_color);
  loadingScreen.setShowLogo(true|false);
  loadingScreen.setLogo(R.drawable.your_logo);
  loadingScreen.setProgressBarColor(your_progress_bar_color);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
   loadingScreen.setCustomFontTypeface(getResources().getFont(R.font.your_custom_font));
  } else {
  loadingScreen.setCustomFontTypeface(Typeface.createFromAsset(getAssets(), "fonts/your_custom_font.ttf")); // example: Typeface.createFromAsset(assets, "fonts/your_custom_font.ttf")
  }

  // Capture Screen

  captureScreen.setCloseImage(R.drawable.your_close_image);
  captureScreen.setReferenceFrame(R.drawable.your_reference_frame);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
   captureScreen.setCustomFontTypeface(getResources().getFont(R.font.your_custom_font));
  } else {
  captureScreen.setCustomFontTypeface(Typeface.createFromAsset(getAssets(), "fonts/your_custom_font.ttf")); // example: Typeface.createFromAsset(assets, "fonts/your_custom_font.ttf")
  }

  cardCustomization.setButtonCustomization(button);
  cardCustomization.setLoadingScreenCustomization(loadingScreen);
  cardCustomization.setCaptureScreenCustomization(captureScreen);

  AKCardCapture.setCustomization(cardCustomization);

}

Custom alert style

If you want to customize the alert style you can add the following style in your styles.xml file:

styles.xml
<style name="AlertDialogCustom" parent="Base.Theme.AppCompat.Dialog.Alert">
  <item name="android:windowBackground">#FFFFFF</item>
  <item name="android:textColorPrimary">#000000</item>
  <item name="android:textColorSecondary">#000000</item>
  <item name="colorAccent">#FE5000</item>
</style>

And set the style in the AKCardCaptureCustomization class with alertStyle property.

Properties

This class has the following properties:

Principal screen


  • backgroundColor: The background color.
  • showBackgroundImage: Show or hide the background image in principal screen (default is false).
  • backgroundImage: The background image of principal screen (if showBackgroundImage is false this image not show).
  • textColor: The color of text (titles, labels).
  • cardRecapture: The icon of recapture card.
  • customFontTypeface: The custom font typeface. Deprecated
  • customHeaderFontTypeface: The custom font typeface for header (Title). Deprecated
  • titleFontTypeface: The custom font typeface for header (Title). New
  • textFontTypeface: The custom font typeface for text. New
  • alertStyle: The custom alert style. Deprecated
  • showExitButton: Show or hide the exit button (default is false).

Button


  • backgroundColor: The background color.
  • textColor: The color of text. Deprecated
  • textSecondaryColor: The color of button text "exit". Deprecated
  • primaryTextColor: The color of text. New
  • secondaryTextColor: The color of button text "exit". New
  • disableTextColor: The color of text when the button is disabled.
  • disableBackgroundColor: The background color when the button is disabled.
  • customFontTypeface: The custom font typeface button. Deprecated
  • fontTypeface: The custom font typeface button. New
  • textSize: The size of text.

Loading Screen


  • backgroundColor: The background color.
  • showBackgroundImage: Show or hide the background image (default is false).
  • backgroundImage: The background image (if showBackgroundImage is false this image not show).
  • showLogo: Show or hide the logo (default is true).
  • logo: The logo bottom (if showLogo is false this image not show).
  • progressBarColor: The color of progress bar.
  • textColor: The color of text.
  • customFontTypeface: The custom font typeface. Deprecated
  • fontTypeface: The custom font typeface. New

Capture Screen


  • referenceFrame: The reference frame of card.
  • closeImage: The close image.
  • customFontTypeface: The custom font typeface. Deprecated
  • fontTypeface: The custom font typeface. New

Texts


For change the texts of the principal screen, loading screen and capture screen you can override the following values in your strings.xml file:

If you want to change the texts, you have to add strings.xml (es) file in your project for spanish language.
strings.xml
<!--Step Card Activity-->
<string name="ak_card_id_title">Capture your card ID</string>
<string name="ak_card_passport_title">Capture your Passport</string>
<string name="ak_card_getting_params">Getting params</string>
<string name="ak_card_front_label">Front Capture</string>
<string name="ak_card_back_label">Back Capture</string>
<string name="ak_card_capture">Capture</string>
<string name="ak_card_continue_button">Continue</string>
<string name="ak_card_process">Processing Card ID Capture</string>
<string name="ak_card_passport_process">Processing Passport Capture</string>
<string name="ak_card_exit_button">Exit</string>

<!--Capture Activity-->
<string name="ak_card_front">FRONT CAPTURE\nAvoid glare, shadows or blurry photos.</string>
<string name="ak_card_capture_back">BACK CAPTURE\nAvoid glare, shadows or blurry photos.</string>

<!--Alert-->
<string name="ak_card_alert_ok">OK</string>
<string name="aK_card_recapture_button">Recapture</string>
<string name="ak_card_keep_camera_in_ID">Keep the camera on the card ID.</string>
<string name="ak_card_invalid_capture_title">Invalid</string>
<string name="ak_card_invalid_capture_description">The veracity</string>
strings.xml (es)
<!--Step Card Activity-->
<string name="ak_card_id_title">Captura tú cédula</string>
<string name="ak_card_passport_title">Captura tú pasaporte</string>
<string name="ak_card_getting_params">Obtiendo parametros</string>
<string name="ak_card_front_label">Captura Frontal</string>
<string name="ak_card_back_label">Captura Posterior</string>
<string name="ak_card_capture">Capturar</string>
<string name="ak_card_continue_button">Continuar</string>
<string name="ak_card_process">Procesando Captura de Cédula</string>
<string name="ak_card_passport_process">Procesando Captura de Pasaporte</string>
<string name="ak_card_exit_button">Salir</string>

<!--Capture Activity-->
<string name="ak_card_front">CAPTURA FRONTAL\nEvita brillos, sombras o fotos borrosas.</string>
<string name="ak_card_capture_back">CAPTURA POSTERIOR\nEvita brillos, sombras o fotos borrosas.</string>

<!--Alert-->
<string name="ak_card_alert_ok">OK</string>
<string name="aK_card_recapture_button">Capturar de nuevo</string>
<string name="ak_card_keep_camera_in_ID">Manten la cámara en la cédula</string>
<string name="ak_card_invalid_capture_title">Captura invalida</string>
<string name="ak_card_invalid_capture_description">Documento no valido</string>