use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class HeaderFragment method init_standard_header_without_buttons.
/**
* This method builds a standard header without buttons
*/
private void init_standard_header_without_buttons() {
//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));
card.addCardHeader(header);
//Set card in the CardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_std);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class HeaderFragment method init_header_buttonleft.
/**
* This method builds a header with full custom layout, with buttons on the left
*/
private void init_header_buttonleft() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity(), R.layout.carddemo_buttonleft_inner_header);
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
header.setOtherButtonVisible(true);
header.setOtherButtonClickListener(new CardHeader.OnClickCardHeaderOtherButtonListener() {
@Override
public void onButtonItemClick(Card card, View view) {
//Example to change dinamically the button resources
card.getCardHeader().setOtherButtonDrawable(R.drawable.card_menu_button_other_add);
card.getCardView().refreshCard(card);
}
});
card.addCardHeader(header);
//Set card in the CardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_buttonleft);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardHeader 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);
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class TodoNativeCardFragment method init_simple_card.
private void init_simple_card() {
Card card = new Card(getActivity());
CardHeader header = new CardHeader(getActivity());
header.setTitle("Header");
//Add a popup menu. This method set OverFlow button to visible
header.setPopupMenu(R.menu.popupmain, new CardHeader.OnClickCardHeaderPopupMenuListener() {
@Override
public void onMenuItemClick(BaseCard card, MenuItem item) {
Toast.makeText(getActivity(), "Click on " + item.getTitle(), Toast.LENGTH_SHORT).show();
}
});
card.addCardHeader(header);
//Set card in the CardViewNative
CardViewNative CardViewNative = (CardViewNative) getActivity().findViewById(R.id.carddemo_card_id);
CardViewNative.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class CardExpandFragment method init_standard_header_with_expandcollapse_button.
/**
* This method builds a standard header with base expand/collapse
*/
private void init_standard_header_with_expandcollapse_button() {
//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
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand1);
cardView.setCard(card);
}
Aggregations