use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class GoogleKnowwithList method initCardHeader.
@Override
protected CardHeader initCardHeader() {
// Add Header
CardHeader header = new CardHeader(getContext(), R.layout.carddemo_googleknow_withlist_inner_header) {
@Override
public void setupInnerViewElements(ViewGroup parent, View view) {
super.setupInnerViewElements(parent, view);
TextView subTitle = (TextView) view.findViewById(R.id.carddemo_googleknow_sub_title);
if (subTitle != null) {
// Should use strings.xml
subTitle.setText("To see posts from friends and family,add them.");
}
}
};
// should use strings.xml
header.setTitle("You may know");
return header;
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class WeatherCard method initCardHeader.
@Override
protected CardHeader initCardHeader() {
// Add Header
CardHeader header = new CardHeader(getContext());
// Add a popup menu. This method set OverFlow button to visible
header.setPopupMenu(R.menu.extras_popupmain, new CardHeader.OnClickCardHeaderPopupMenuListener() {
@Override
public void onMenuItemClick(BaseCard card, MenuItem item) {
Toast.makeText(getContext(), "Click on " + item.getTitle(), Toast.LENGTH_SHORT).show();
}
});
// should use R.string.
header.setTitle("ROMA (IT)");
return header;
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class NativeRecyclerViewFragment method initCard.
/**
* This method builds a simple list of cards
*/
private ArrayList<Card> initCard() {
// Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
Card card = new Card(this.getActivity());
card.setTitle("Application example " + i);
// Create a CardHeader
CardHeader header = new CardHeader(getActivity());
// Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
if (i < 10) {
// 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);
} else {
// Set visible the expand/collapse button
header.setButtonExpandVisible(true);
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_basetitle));
card.addCardExpand(expand);
if (i == 12 || i == 17 || i == 19)
card.setExpanded(true);
}
// Add ClickListener
card.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Click Listener card=" + card.getTitle(), Toast.LENGTH_SHORT).show();
}
});
cards.add(card);
}
return cards;
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_simple_card.
/**
* This method builds a simple card
*/
private void init_simple_card() {
// 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 the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
// Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_card_id);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardHeader in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_card_inner_layout.
/**
* This method builds a simple card with a custom inner layout
*/
private void init_card_inner_layout() {
// Create a Card
Card card = new Card(getActivity(), R.layout.carddemo_example_inner_content);
// Create a CardHeader
CardHeader header = new CardHeader(getActivity());
// Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
// Set the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
// Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_card_inner);
cardView.setCard(card);
}
Aggregations