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.
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:
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))
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.
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)
}
Custom alert style
If you want to customize the alert style you can add the following style in your styles.xml
file:
<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:
<!--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>