本文整理汇总了Java中it.gmariotti.cardslib.library.internal.CardHeader类的典型用法代码示例。如果您正苦于以下问题:Java CardHeader类的具体用法?Java CardHeader怎么用?Java CardHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CardHeader类属于it.gmariotti.cardslib.library.internal包,在下文中一共展示了CardHeader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCustomOverflowAnimation
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* Add Custom Overflow Animation
*/
private void addCustomOverflowAnimation() {
final CardHeader.CustomOverflowAnimation animation = mCardHeader.getCustomOverflowAnimation();
if (animation != null && mImageButtonOverflow != null) {
//Add a PopupMenu and its listener
mImageButtonOverflow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animation.doAnimation(mCardHeader.getParentCard(), v);
}
});
} else {
if (mImageButtonOverflow != null)
mImageButtonOverflow.setVisibility(GONE);
}
}
示例2: _buildPopupMenu
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* Build the menu
* @return
*/
private PopupMenu _buildPopupMenu(){
PopupMenu popup = new PopupMenu(getContext(), mImageButtonOverflow);
if (mCardHeader.getPopupMenu()> CardHeader.NO_POPUP_MENU){
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(mCardHeader.getPopupMenu(), popup.getMenu());
}
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (mCardHeader.getPopupMenuListener() != null) {
// This individual card has it unique menu
mCardHeader.getPopupMenuListener().onMenuItemClick(mCardHeader.getParentCard(), item);
}
return false;
}
});
return popup;
}
示例3: changeOverflowIconSelection
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* Internal method to change the state of overflow icon on the view and on the model
*
* @param selected
*/
protected void changeOverflowIconSelection(boolean selected){
if (mCard==null) return;
//Change the value on the card and inside
CardHeader header = mCard.getCardHeader();
if (header!=null){
this.selected=selected;
header.setOverflowSelected(selected);
}
//Change the imageButton state
CardView cardView = mCard.getCardView();
if (cardView!=null){
if (cardView.getInternalHeaderLayout()!=null && cardView.getInternalHeaderLayout().getImageButtonOverflow()!=null)
cardView.getInternalHeaderLayout().getImageButtonOverflow().setSelected(selected);
}
}
示例4: init_simple_card
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* 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
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_id);
cardView.setCard(card);
}
示例5: init_card_inner_layout
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* 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
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_inner);
cardView.setCard(card);
}
示例6: init_card_without_shadow
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* This method builds a card without shadow
*/
private void init_card_without_shadow() {
//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);
//Hidden shadow
card.setShadow(false);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_shadow_no);
cardView.setCard(card);
}
示例7: init_card_custom_shadow_layout
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* This methods builds a card with a custom shadow layout (compound view)
* <b>WARNING</b>
* See https://github.com/gabrielemariotti/cardslib/tree/master/SHADOW.md for more information.
* You can quickly modify your shadow with your style and drawable files without modifying shadow layout.
*/
private void init_card_custom_shadow_layout() {
//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_shadow_layout);
cardView.setCard(card);
}
示例8: init
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
private void init(){
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
addCardHeader(header);
//Add ClickListener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card=" + getTitle(), Toast.LENGTH_SHORT).show();
}
});
setSwipeable(true);
}
示例9: init_standard_header_without_buttons
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
/**
* 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);
}
示例10: init
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
private void init(){
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(mTitleHeader);
addCardHeader(header);
CardThumbnail thumb = new CardThumbnail(getActivity());
thumb.setDrawableResource(R.drawable.ic_launcher);
addCardThumbnail(thumb);
//Add ClickListener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card=" + mTitleHeader, Toast.LENGTH_LONG).show();
}
});
//Set the card inner text
setTitle(mTitleMain);
}
示例11: init
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
private void init() {
CardHeader header = new CardHeader(getContext());
header.setButtonOverflowVisible(true);
header.setTitle("Google Maps");
header.setPopupMenu(R.menu.popupmain, new CardHeader.OnClickCardHeaderPopupMenuListener() {
@Override
public void onMenuItemClick(BaseCard card, MenuItem item) {
Toast.makeText(getContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
}
});
addCardHeader(header);
GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());
thumbnail.setDrawableResource(R.drawable.carddemo_ic_gmaps_large);
addCardThumbnail(thumbnail);
}
示例12: init
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
private void init() {
//Add Header
CardHeader header = new MayKnowCardHeader(getContext(), R.layout.carddemo_mayknow_inner_header);
header.setTitle(getContext().getString(R.string.may_know_card_title));
addCardHeader(header);
setShadow(false);
//Add Thumbnail
CardThumbnail thumbnail = new CardThumbnail(getContext());
thumbnail.setUrlResource("https://plus.google.com/s2/photos/profile/114432517923423045208?sz=72");
thumbnail.setErrorResource(R.drawable.ic_error_loadingsmall);
addCardThumbnail(thumbnail);
OnCardClickListener clickListener = new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
//Do something
}
};
addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW,clickListener);
}
示例13: createAddCard
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
private void createAddCard() {
//Create new header and set the title
CardHeader addLocationHeader = new CardHeader(this);
addLocationHeader.setTitle("Add New Location");
//Create new card instance
Card addLocation = new Card(this);
//Set thumbnail and drawable resource
CardThumbnail addLocationThumb = new CardThumbnail(this);
addLocationThumb.setDrawableResource(R.drawable.plus);
//Set color
addLocation.setBackgroundResourceId(R.color.darkred);
//Add header
addLocation.addCardHeader(addLocationHeader);
//Add thumbnail
addLocation.addCardThumbnail(addLocationThumb);
//Set clickable
addLocation.setClickable(true);
//Add to arraylist
cards.add(addLocation);
//Set onClick listener
addLocation.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
//Set intent to AddLocation screen
Intent intent = new Intent(MainActivity.this, AddLocationActivity.class);
startActivity(intent);
}
});
}
示例14: createViewCard
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
private void createViewCard() {
//Create new header and set the title
CardHeader addLocationHeader = new CardHeader(this);
addLocationHeader.setTitle("View Current Database");
//Create new card instance
Card addLocation = new Card(this);
//Set thumbnail and drawable resource
//CardThumbnail addLocationThumb = new CardThumbnail(this);
//addLocationThumb.setDrawableResource(R.drawable.hacker);
//Set color
addLocation.setBackgroundResourceId(R.color.darkorange);
//Add header
addLocation.addCardHeader(addLocationHeader);
//Add thumbnail
//addLocation.addCardThumbnail(addLocationThumb);
//Set clickable
addLocation.setClickable(true);
//Add to arraylist
cards.add(addLocation);
//Set onClick listener
addLocation.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
//Set intent to AddLocation screen
Intent intent = new Intent(MainActivity.this, ViewLocationsActivity.class);
startActivity(intent);
}
});
}
示例15: initCardHeader
import it.gmariotti.cardslib.library.internal.CardHeader; //导入依赖的package包/类
@Override
protected CardHeader initCardHeader()
{
CardHeader header=new CardHeader(getContext(), R.layout.card_general_info_inner_header);
header.setTitle(title);
return header;
}