-
Notifications
You must be signed in to change notification settings - Fork 377
BasicButtonsCard
dexafree edited this page Apr 14, 2015
·
6 revisions
BasicButtonsCard is a simple Card that shows a title, a description, and offers two buttons.
For title and description, you only need to call the setTitle(String title)
and setDescription(String description)
methods
BasicButtonsCard card = new BasicButtonsCard(context);
card.setTitle("Your title");
card.setDescription("Your description");
The text shown in both buttons can also be set, just by calling BasicButtonsCard.setLeftButtonText(String text)
(or its right equivalent).
card.setLeftButtonText("LEFT");
card.setRightButtonText("RIGHT");
You can also define behaviours for the button pressing. You only need to call BasicImageButtonsCard.setOnLeftButtonPressedListener(OnButtonPressListener)
(or its equivalent for the right button) and define its behaviour.
As you can see, you will receive the View and the Card attached to that View, in order to recover the data from it.
Example:
card.setOnRightButtonPressedListener(new OnButtonPressListener() {
@Override
public void onButtonPressedListener(View view, Card card) {
Toast.makeText( mContext,
"You have pressed the right button",
Toast.LENGTH_SHORT
).show();
}
});