public abstract class

Card

extends Object
java.lang.Object
   ↳ com.usebutton.sdk.purchasepath.Card
Known Direct Subclasses

Class Overview

Base template class for checkout extension overlay cards.

Summary

Constants
float DEFAULT_TEXT_SIZE_BODY
float DEFAULT_TEXT_SIZE_TITLE
Public Constructors
Card(CallToAction callToAction)
Creates a new card instance with the given call to action.
Public Methods
final void bindView(View view)
Invoked by the checkout system when a view should be populated with the card data.
final View createView(ViewGroup parent)
Invoked by the checkout system when a new view is needed to display card contents.
boolean equals(Object obj)
final BrowserInterface getBrowser()
A reference to the checkout interface.
CallToAction getCallToAction()
Get the public call to action for the active state.
Object getKey()
Gets the key of this card.
final View getView()
The view instance currently associated with this card.
int hashCode()
final void setBrowser(BrowserInterface browser)
void setKey(Object key)
Sets the key of the card.
Protected Methods
abstract void onBindView(View view)
Called when an inflated card view should be populated with data for display.
abstract View onCreateView(ViewGroup parent)
Called when a view should be inflated to display the card contents.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final float DEFAULT_TEXT_SIZE_BODY

Constant Value: 13.0

public static final float DEFAULT_TEXT_SIZE_TITLE

Constant Value: 16.0

Public Constructors

public Card (CallToAction callToAction)

Creates a new card instance with the given call to action.

Parameters
callToAction call to action that will be displayed when the card is "active".

Public Methods

public final void bindView (View view)

Invoked by the checkout system when a view should be populated with the card data. Delegates to onBindView(View) and performs other internal initialization.

Parameters
view a view instance inflated by onCreateView(ViewGroup) to display the card contents.

public final View createView (ViewGroup parent)

Invoked by the checkout system when a new view is needed to display card contents. Delegates to onCreateView(ViewGroup) and performs other internal initialization.

Parameters
parent ViewGroup where newly inflated view should be attached.
Returns
  • the view inflated by .

public boolean equals (Object obj)

public final BrowserInterface getBrowser ()

A reference to the checkout interface. Use this, for example, to make any changes to the top or bottom bars, add, update, or remove cards when a user interacts with a card instance.

Returns

public CallToAction getCallToAction ()

Get the public call to action for the active state.

Returns
  • the call to action for this card.

public Object getKey ()

Gets the key of this card.

Returns
  • key object.

public final View getView ()

The view instance currently associated with this card. Use this to make any updates to your view, for example, when a user interacts with the view.

Returns
  • Nullable value when a card instance has an associated view representing it

public int hashCode ()

public final void setBrowser (BrowserInterface browser)

public void setKey (Object key)

Sets the key of the card. Keys are meant to be unique. If multiple cards match the given key, There can be issue trying to get the correct card from the CardList

Parameters
key Object.

Protected Methods

protected abstract void onBindView (View view)

Called when an inflated card view should be populated with data for display.

Parameters
view instance of the view returned from onCreateView(ViewGroup)

protected abstract View onCreateView (ViewGroup parent)

Called when a view should be inflated to display the card contents. Subclasses should override this method

Parameters
parent ViewGroup where newly inflated view should be attached.
Returns
  • the newly inflated view that can display the card contents.