public class

InteractiveButton

extends BaseButton
java.lang.Object
   ↳ BaseButton
     ↳ com.usebutton.sdk.InteractiveButton

Class Overview

The InteractiveButton is an alternative to ButtonDropin 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 ButtonContext context = ButtonContext.withSubjectLocation(venue);
 final InteractiveButton button = (InteractiveButton) findViewById(R.id.my_activity_button_interactive);
 Button.getButton(this).getAction("btn-your-id", context, new Button.ActionListener() {
     @Override
     public void onAction(final AppAction action) {
         // Let's setup our Button
         button.prepareWithAction(action);
     }

     @Override
     public void onNoAction() {
         button.setVisibility(View.GONE);
     }
 });
 

Summary

Public Constructors
InteractiveButton(Context context)
InteractiveButton(Context context, AttributeSet attrs)
InteractiveButton(Context context, AttributeSet attrs, int defStyleAttr)
InteractiveButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
void prepareWithAction(AppAction action)
Call this to prepare the InteractiveButton with an AppAction and show its inventory.
void setInventoryLeftPadding_Button(int leftPadding)
Set the padding between the left edge of the view and the first inventory item.
Protected Methods
void onAttachedToWindow()
void onLayout(boolean changed, int left, int top, int right, int bottom)
void reportViewed()
[Expand]
Inherited Methods
From class java.lang.Object

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 (AppAction 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 getAction(String, ButtonContext, Button.ActionListener) on how to get a valid AppAction object.

Parameters
action or null to 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 ()