java.lang.Object |
↳ |
BaseButton |
|
↳ |
com.usebutton.sdk.InteractiveButton |
Class Overview
The InteractiveButton is an alternative to DropinButton
and will give the user a swipable
list of top-level options to choose from for a direct link into the commerce application.
This class has a minimum height requirements and should get as close to full screen width as your
design and layout accommodates.
You can control several aspects of the layout of this class using XML attributes:
- button:btn_drawablePaddingLeft
- button:btn_drawablePaddingRight
- button:btn_iconSize
- button:btn_backgroundColor
- button:btn_backgroundDrawable
- button:btn_textSize
Code example:
final Location venue = new Location("Madison Square Garden");
venue.putIdentifier(Identifiers.IDENTIFIER_TICKETMASTER, "483329");
final ActionQuery context = ActionQuery.withSubjectLocation(venue);
final InteractiveButton button = (InteractiveButton) findViewById(R.id.my_activity_button_interactive);
Button.getButton(this).getAction("btn-your-id", context, new AppActionCallbacks() {
@Override
public void onAction(final AppAction action) {
// Let's setup our Button
button.prepareWithAction(action);
}
@Override
public void onNoAction() {
button.setVisibility(View.GONE);
}
});
Summary
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public Constructors
public
InteractiveButton
(Context context)
public
InteractiveButton
(Context context, AttributeSet attrs)
public
InteractiveButton
(Context context, AttributeSet attrs, int defStyleAttr)
public
InteractiveButton
(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
public
void
prepareWithAction
(ButtonAction action)
Call this to prepare the InteractiveButton with an AppAction and show its inventory.
Before calling this, or if passing @{code null} the button will render a loading state.
See actions()
on how to fetch a valid ButtonAction
object.
Parameters
action
| or null to show a loading state. An action that does not contain any
groups will also be treated as null and show a loading state. |
public
void
setInventoryLeftPadding_Button
(int leftPadding)
Set the padding between the left edge of the view and the first inventory item.
Equivalent to using the button:btn_inventoryLeftPadding
attribute in a layout XML.
Parameters
leftPadding
| pixels of left padding
|
Protected Methods
protected
void
onAttachedToWindow
()
protected
void
onLayout
(boolean changed, int left, int top, int right, int bottom)
protected
void
reportViewed
()