use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class PojoDataParser method parseFooterCell.
protected void parseFooterCell(BaseCell footerCell, Card card) {
card.mFooter = footerCell;
if (card instanceof GridCard) {
GridCard gridCard = (GridCard) card;
gridCard.ensureBlock(card.mFooter);
} else if (card instanceof OnePlusNCard) {
OnePlusNCard onePlusNCard = (OnePlusNCard) card;
onePlusNCard.ensureBlock(card.mFooter);
}
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class TangramEngine method topPosition.
/**
* {@inheritDoc}
*/
@Override
public void topPosition(Card card) {
List<BaseCell> cells = card.getCells();
if (cells.size() > 0) {
BaseCell cell = cells.get(0);
int pos = mGroupBasicAdapter.getComponents().indexOf(cell);
if (pos > 0) {
VirtualLayoutManager lm = getLayoutManager();
View view = lm.findViewByPosition(pos);
if (view != null) {
int top = lm.getDecoratedTop(view);
RecyclerView recyclerView = getContentView();
if (recyclerView != null) {
recyclerView.scrollBy(0, top);
}
} else {
RecyclerView recyclerView = getContentView();
if (recyclerView != null) {
recyclerView.scrollToPosition(pos);
}
}
}
}
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class TangramEngine method scrollToPosition.
/**
* {@inheritDoc}
*/
@Override
public void scrollToPosition(Card card) {
List<BaseCell> cells = card.getCells();
if (cells.size() > 0) {
BaseCell cell = cells.get(0);
int pos = mGroupBasicAdapter.getComponents().indexOf(cell);
if (pos > 0) {
RecyclerView recyclerView = getContentView();
if (recyclerView != null) {
recyclerView.scrollToPosition(pos);
}
}
}
}
use of com.tmall.wireless.tangram3.structure.BaseCell in project Tangram-Android by alibaba.
the class TangramEngine method removeBy.
/**
* Remove cell at target position. TODO handle nested card
*
* @param position
* @since 2.1.0
*/
public void removeBy(int position) {
if (mGroupBasicAdapter != null) {
if (position < mGroupBasicAdapter.getItemCount() && position >= 0) {
BaseCell removeCell = mGroupBasicAdapter.getItemByPosition(position);
removeBy(removeCell);
}
}
}
Aggregations