Payment Card Details Single Line View
Convenience view for collecting card details from a user. All card fields are combined into a single-line view
Important:
User-entered card details are intentionally restricted to reduce PCI compliance scope
Styling/Branding
This view provides full support for styling and customization, which can be accomplished in the following ways:
Individual Style Attributes: Style specific aspects of the view individually
Text Appearance Style Attributes: Style text using Android's TextAppearance styles
Background Resource Attributes: Style the background using drawable resources
XML attributes can be set directly on the view or they can be defined in a style that gets applied to the view. The following examples each produce the same result:
Customizations applied directly to the view:
// NOTE: This example assumes a namespace definition of `app`. Replace
// this with your own namespace qualifier if using something different
<com.olo.olopay.controls.PaymentCardDetailsSingleLineView
app:cardBorderColor="@color/android:black"
app:cardBorderWidth="2dp" />
/>
Customizations applied in a style:
// Style definition
<style name="MyCardStyle">
<item name="cardBorderColor">@color/android:black</item>
<item name="cardBorderWidth">2dp</item>
</style>
// Layout file
<com.olo.olopay.controls.PaymentCardDetailsSingleLineView
style="@style/MyCardStyle" />
Individual Style Attributes
These attributes are responsible for controlling a single aspect of the view. In the case of conflicting styles between these attributes and Text Appearance Style Attributes or Background Resource Attributes these attributes take precedence.
This view supports the following attributes for styling/branding purposes:
cardBackgroundColor / (See setCardBackgroundStyle)
cardBorderColor / (See setCardBackgroundStyle)
cardBorderWidth / (See setCardBackgroundStyle)
cardBorderRadius / (See setCardBackgroundStyle)
cardStartPadding / (See setCardPadding)
cardTopPadding / (See setCardPadding)
cardEndPadding / (See setCardPadding)
cardBottomPadding / (See setCardPadding)
verticalSpacing / (See setVerticalSpacing)
errorBackgroundColor / (See setErrorBackgroundStyle)
errorBorderColor / (See setErrorBackgroundStyle)
errorBorderWidth / (See setErrorBackgroundStyle)
errorBorderRadius / (See setErrorBackgroundStyle)
errorStartPadding / (See setErrorPadding)
errorTopPadding / (See setErrorPadding)
errorEndPadding / (See setErrorPadding)
errorBottomPadding / (See setErrorPadding)
textColor / (See setTextColor)
errorTextColor / (See setErrorTextColor)
errorGravity / (See setErrorGravity)
hintTextColor / (See setHintTextColor)
cursorColor / (See setCursorColor)
textSize / (See setTextSize)
errorTextSize / (See setErrorTextSize)
cardNumberHint / (See setHintText)
expirationHint / (See setHintText)
cvvHint / (See setHintText)
postalCodeHint / (See setHintText)
postalCodeEnabled / (See postalCodeEnabled)
displayErrors / (See displayErrors)
Important:
Some customizations are only possible when using Text Appearance Style Attributes or Background Resource Attributes. Refer to those sections for more information.
Text Appearance Attributes
Unlike the text attributes specified in Individual Style Attributes above, where each attribute specifies one aspect of the text's appearance, these attributes define the entire appearance through one attribute using a text appearance style. These styles can define text color, text size, hint text color, or even have different appearances defined based on the state of the view (e.g. focused or unfocused, enabled or disabled). For a full list of available attributes, see TextAppearance.
This view supports the following text appearance resource attributes for styling/branding purposes:
textAppearance / (See setTextAppearance)
errorTextAppearance / (See setErrorTextAppearance)
Important
Text attributes defined directly on this view (from the Individual Style Attributes section above) will override attributes defined by the textAppearance
and errorTextAppearance
attributes
Background Attributes
Unlike the background attributes specified in Individual Style Attributes above, where each attribute specifies one aspect of the background, these attributes define the entire background through one resource id. For example, a single drawable resource could be used that specifies padding, border color, border radius, and a gradient background, or even have different backgrounds defined based on the state of the view (e.g. focused or unfocused, enabled or disabled).
This view supports the following background resource attributes for styling/branding purposes:
cardBackground / (See setCardBackgroundResource)
errorBackground / (See setErrorBackgroundResource)
Important
Background attributes from the Individual Style Attributes section above take precedence over these background attributes.
Constructors
Creates a new instance of PaymentCardDetailsSingleLineView
Properties
Set this to receive callbacks about card input events for this control
Set this to receive notifications when configuration changes occur
XML Attribute: displayErrors
Provides a snapshot of the current state of each card field
Get an IPaymentMethodParams instance that can be used to create an IPaymentMethod instance. If the form is not valid this will return null.
XML Attribute: postalCodeEnabled
Functions
Clears all text fields in the control
Dismisses the keyboard, if visible, and removes focus from input fields in this control
Gets the font of the error message
Get the error message that would be displayed if displayErrors is true
and isValid is false. Note that isValid having a value of false
does not necessarily mean there will be an error message (see ignoreUneditedFieldErrors param)
Check if there is an error message to be displayed.
Moves focus to the specified input field
XML Attribute: cardBackground
XML Attributes: cardBackgroundColor, cardBorderColor, cardBorderWidth, cardBorderRadius
Sets the card number. Does not change field focus
XML Attributes: cardStartPadding, cardTopPadding, cardEndPadding, cardBottomPadding
XML Attribute: cursorColor
XML Attribute: android:enabled
XML Attribute: errorBackground
XML Attributes: errorBackgroundColor, errorBorderColor, errorBorderWidth, errorBorderRadius
Sets the error font for error messages
XML Attribute: errorGravity
XML Attributes: errorStartPadding, errorTopPadding, errorEndPadding, errorBottomPadding
XML Attribute: errorTextAppearance
XML Attribute: errorTextColor
XML Attribute: errorTextSize
Set the expiration date. This invokes the completion listener and changes focus to the CVV field if a valid date is entered
XML Attributes: cardNumberHint, expirationHint, cvvHint, postalCodeHint
XML Attribute: hintTextColor
XML Attribute: textAppearance
XML Attribute: textColor
XML Attribute: textSize
XML Attribute: verticalSpacing