use of it.gmariotti.cardslib.demo.cards.CustomExpandCard in project cardslib by gabrielemariotti.
the class NativeListExpandCardFragment method init_standard_header_with_expandcollapse_button_custom_area.
/**
* This method builds a standard header with a custom expand/collpase
*/
private Card init_standard_header_with_expandcollapse_button_custom_area(String titleHeader, int i) {
// Create a Card
Card card = new Card(getActivity());
// Create a CardHeader
CardHeader header = new CardHeader(getActivity());
// Set the header title
header.setTitle(titleHeader);
// Set visible the expand/collapse button
header.setButtonExpandVisible(true);
// Add Header to card
card.addCardHeader(header);
// This provides a simple (and useless) expand area
CustomExpandCard expand = new CustomExpandCard(getActivity(), i);
// Add Expand Area to Card
card.addCardExpand(expand);
// Just an example to expand a card
if (i == 2 || i == 7 || i == 9)
card.setExpanded(true);
// Swipe
card.setSwipeable(true);
// Animator listener
card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {
@Override
public void onExpandEnd(Card card) {
Toast.makeText(getActivity(), "Expand " + card.getCardHeader().getTitle(), Toast.LENGTH_SHORT).show();
}
});
card.setOnCollapseAnimatorEndListener(new Card.OnCollapseAnimatorEndListener() {
@Override
public void onCollapseEnd(Card card) {
Toast.makeText(getActivity(), "Collpase " + card.getCardHeader().getTitle(), Toast.LENGTH_SHORT).show();
}
});
return card;
}
use of it.gmariotti.cardslib.demo.cards.CustomExpandCard in project cardslib by gabrielemariotti.
the class NativeHeaderFragment method init_standard_header_with_expandcollapse_button_custom_area.
/**
* This method builds a standard header with a custom expand/collpase
*/
private void init_standard_header_with_expandcollapse_button_custom_area() {
// Create a Card
Card card = new Card(getActivity());
// Create a CardHeader
CardHeader header = new CardHeader(getActivity());
// Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
// Set visible the expand/collapse button
header.setButtonExpandVisible(true);
// Add Header to card
card.addCardHeader(header);
// This provides a simple (and useless) expand area
CustomExpandCard expand = new CustomExpandCard(getActivity());
// Add Expand Area to Card
card.addCardExpand(expand);
// Set card in the CardViewNative
final CardViewNative cardViewNative = (CardViewNative) getActivity().findViewById(R.id.carddemo_header_expand_custom_area);
// It is not required.
card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {
@Override
public void onExpandEnd(Card card) {
// TODO: check if hidden area is visible and it would be better an animator to do this
}
});
cardViewNative.setCard(card);
}
use of it.gmariotti.cardslib.demo.cards.CustomExpandCard in project cardslib by gabrielemariotti.
the class ListExpandCardFragment method init_standard_header_with_expandcollapse_button_custom_area.
/**
* This method builds a standard header with a custom expand/collpase
*/
private Card init_standard_header_with_expandcollapse_button_custom_area(String titleHeader, int i) {
// Create a Card
Card card = new Card(getActivity());
// Create a CardHeader
CardHeader header = new CardHeader(getActivity());
// Set the header title
header.setTitle(titleHeader);
// Set visible the expand/collapse button
header.setButtonExpandVisible(true);
// Add Header to card
card.addCardHeader(header);
// This provides a simple (and useless) expand area
CustomExpandCard expand = new CustomExpandCard(getActivity(), i);
// Add Expand Area to Card
card.addCardExpand(expand);
// Just an example to expand a card
if (i == 2 || i == 7 || i == 9)
card.setExpanded(true);
// Swipe
card.setSwipeable(true);
// Animator listener
card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {
@Override
public void onExpandEnd(Card card) {
Toast.makeText(getActivity(), "Expand " + card.getCardHeader().getTitle(), Toast.LENGTH_SHORT).show();
}
});
card.setOnCollapseAnimatorEndListener(new Card.OnCollapseAnimatorEndListener() {
@Override
public void onCollapseEnd(Card card) {
Toast.makeText(getActivity(), "Collpase " + card.getCardHeader().getTitle(), Toast.LENGTH_SHORT).show();
}
});
return card;
}
use of it.gmariotti.cardslib.demo.cards.CustomExpandCard in project cardslib by gabrielemariotti.
the class HeaderFragment method init_standard_header_with_expandcollapse_button_custom_area.
/**
* This method builds a standard header with a custom expand/collpase
*/
private void init_standard_header_with_expandcollapse_button_custom_area() {
// Create a Card
Card card = new Card(getActivity());
// Create a CardHeader
CardHeader header = new CardHeader(getActivity());
// Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
// Set visible the expand/collapse button
header.setButtonExpandVisible(true);
// Add Header to card
card.addCardHeader(header);
// This provides a simple (and useless) expand area
CustomExpandCard expand = new CustomExpandCard(getActivity());
// Add Expand Area to Card
card.addCardExpand(expand);
// Set card in the CardView
final CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_expand_custom_area);
// It is not required.
card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {
@Override
public void onExpandEnd(Card card) {
// TODO: check if hidden area is visible and it would be better an animator to do this
}
});
cardView.setCard(card);
}
Aggregations