Skip to content

pin-authentication / io.matthewnelson.pin_authentication.service / PinAuthentication / Builder

Builder

class Builder (source)

Call from the Application’s onCreate() to implement

PinAuthentication.Builder()
    .setApplicationAndBuildConfig(this, BuildConfig.DEBUG)
    .applicationHasOnBoardProcess()
    .enableBackgroundLogoutTimer(4)
    .enableHapticFeedbackByDefault()
    .enablePinSecurityByDefault()
    .enableScrambledPinByDefault()
    .enableWrongPinLockout(10, 3)
    .setMinimumPinLength(4)


    /**
     * Set custom colors for [PinAuthentication]'s Activity which will overwrite
     * the default color value for that view.
     *
     * Colors can also be changed after initialization of
     * [PinAuthentication] by utilizing [PinAuthentication.Settings.setCustomColors]
     * method, and also reset back to the colors chosen here by utilizing the
     * [PinAuthentication.Settings.resetColorsToApplicationDefaults] method.
     *
     * @see [PinAuthentication.Builder.OptionsBuilder.setCustomColors]
     * @see [PinAuthentication.Builder.ColorsBuilder]
     * */
    .setCustomColors()
    .set2_ConfirmButtonBackgroundColor(R.color.secondaryLightColor)
    .set4_PinHintContainerColor(R.color.primaryDarkColor)
    .set6_PinPadButtonBackgroundColor(R.color.primaryDarkColor)
    .set8_ScreenBackgroundColor(R.color.primaryColor)

    /**
     * Calling applyColors from within the Builder will **NOT** return null. null is only
     * returned if calling [PinAuthentication.Settings.setCustomColors].
     *
     * @see [PinAuthentication.Builder.ColorsBuilder.applyColors]
     * */
    .applyColors()!!

    .build()

Types

Name Summary
ColorsBuilder Customize PinAuthenticationActivity‘s colors.class ColorsBuilder
OptionsBuilder Meant to only be used after calling Builder.setApplicationAndBuildConfig, which returns this class.class OptionsBuilder

Constructors

Name Summary
<init> Call from the Application’s onCreate() to implementBuilder()

Functions

Name Summary
setApplicationAndBuildConfig Sets the Application which is used throughout PinAuthentication. It initializes PinAuthentication‘s DaggerApplicationComponent which then is used to inject classes as needed. See CompanionInjection See Companion.injectedfun setApplicationAndBuildConfig(application:Application, buildConfigDebug:Boolean): OptionsBuilder