本文整理匯總了Java中it.gmariotti.cardslib.library.view.listener.UndoCard類的典型用法代碼示例。如果您正苦於以下問題:Java UndoCard類的具體用法?Java UndoCard怎麽用?Java UndoCard使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UndoCard類屬於it.gmariotti.cardslib.library.view.listener包,在下文中一共展示了UndoCard類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDismiss
import it.gmariotti.cardslib.library.view.listener.UndoCard; //導入依賴的package包/類
@Override
public void onDismiss(ListView listView, int[] reverseSortedPositions) {
int[] itemPositions=new int[reverseSortedPositions.length];
String[] itemIds=new String[reverseSortedPositions.length];
int i=0;
//Remove cards and notifyDataSetChanged
for (int position : reverseSortedPositions) {
Card card = null;
if (listView.getAdapter() != null && listView.getAdapter().getItem(position) instanceof Card)
card = (Card) listView.getAdapter().getItem(position);
//Card card = getItem(position);
if (card != null) {
itemPositions[i] = position;
itemIds[i] = card.getId();
i++;
/*
if (card.isExpanded()){
if (card.getCardView()!=null && card.getCardView().getOnExpandListAnimatorListener()!=null){
//There is a List Animator.
card.getCardView().getOnExpandListAnimatorListener().onCollapseStart(card.getCardView(), card.getCardView().getInternalExpandLayout());
}
}*/
remove(card);
if (card.getOnSwipeListener() != null) {
card.getOnSwipeListener().onSwipe(card);
}
}else{
Log.e(TAG,"Error on swipe action. Impossible to retrieve the card from position");
}
}
notifyDataSetChanged();
//Check for a undo message to confirm
if (isEnableUndo() && mUndoBarController!=null){
//Show UndoBar
UndoCard itemUndo=new UndoCard(itemPositions,itemIds);
//MessageUndoBar
String messageUndoBar=null;
if (getUndoBarController().getUndoBarUIElements()!=null){
messageUndoBar = getUndoBarController().getUndoBarUIElements().getMessageUndo(CardArrayAdapter.this,itemIds,itemPositions);
}
//Default message if null
if (messageUndoBar == null) {
if (getContext() != null) {
Resources res = getContext().getResources();
if (res != null) {
messageUndoBar = res.getQuantityString(R.plurals.list_card_undo_items, reverseSortedPositions.length, reverseSortedPositions.length);
}
}
}
mUndoBarController.showUndoBar(
false,
messageUndoBar,
itemUndo);
}
}
示例2: onDismiss
import it.gmariotti.cardslib.library.view.listener.UndoCard; //導入依賴的package包/類
@Override
public void onDismiss(ListView listView, int[] reverseSortedPositions) {
int[] itemPositions=new int[reverseSortedPositions.length];
String[] itemIds=new String[reverseSortedPositions.length];
int i=0;
//Remove cards and notifyDataSetChanged
for (int position : reverseSortedPositions) {
Card card = getItem(position);
itemPositions[i]=position;
itemIds[i]=card.getId();
i++;
/*
if (card.isExpanded()){
if (card.getCardView()!=null && card.getCardView().getOnExpandListAnimatorListener()!=null){
//There is a List Animator.
card.getCardView().getOnExpandListAnimatorListener().onCollapseStart(card.getCardView(), card.getCardView().getInternalExpandLayout());
}
}*/
remove(card);
if (card.getOnSwipeListener() != null){
card.getOnSwipeListener().onSwipe(card);
}
}
notifyDataSetChanged();
//Check for a undo message to confirm
if (isEnableUndo() && mUndoBarController!=null){
//Show UndoBar
UndoCard itemUndo=new UndoCard(itemPositions,itemIds);
if (getContext()!=null){
Resources res = getContext().getResources();
if (res!=null){
String messageUndoBar = res.getQuantityString(R.plurals.list_card_undo_items, reverseSortedPositions.length, reverseSortedPositions.length);
mUndoBarController.showUndoBar(
false,
messageUndoBar,
itemUndo);
}
}
}
}