本文整理匯總了Java中com.alibaba.android.vlayout.Range.create方法的典型用法代碼示例。如果您正苦於以下問題:Java Range.create方法的具體用法?Java Range.create怎麽用?Java Range.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.alibaba.android.vlayout.Range
的用法示例。
在下文中一共展示了Range.create方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setRange
import com.alibaba.android.vlayout.Range; //導入方法依賴的package包/類
/**
* @param start offset relative to its parent
* @param end offset relative to its parent
*/
public void setRange(int start, int end) {
mRange = Range.create(start, end);
if (!mChildren.isEmpty()) {
SimpleArrayMap<Range<Integer>, T> newMap = new SimpleArrayMap<>();
for (int i = 0, size = mChildren.size(); i < size; i++) {
T rangeStyle = mChildren.valueAt(i);
int newStart = rangeStyle.getOriginStartOffset() + start;
int newEnd = rangeStyle.getOriginEndOffset() + start;
Range<Integer> newRange = Range.create(newStart, newEnd);
newMap.put(newRange, rangeStyle);
rangeStyle.setRange(newStart, newEnd);
}
mChildren.clear();
mChildren.putAll(newMap);
}
}
示例2: isRecyclable
import com.alibaba.android.vlayout.Range; //導入方法依賴的package包/類
@Override
public boolean isRecyclable(int childPos, int startIndex, int endIndex, LayoutManagerHelper helper, boolean fromStart) {
Range<Integer> range = getRange();
if (range.contains(childPos)) {
if (hasHeader && childPos == getRange().getLower()) {
return true;
}
if (hasFooter && childPos == getRange().getUpper()) {
return true;
}
Range<Integer> childRange = Range.create(range.getLower() + (hasHeader ? 1 : 0),
range.getUpper() - (hasFooter ? 1 : 0));
return Range.create(startIndex, endIndex).contains(childRange);
} else {
Log.w(TAG, "Child item not match");
return true;
}
}
示例3: addChildCard
import com.alibaba.android.vlayout.Range; //導入方法依賴的package包/類
@Override
public void addChildCard(Card card) {
if (card == null) {
return;
}
List<BaseCell> subCells = card.getCells();
if (subCells != null && !subCells.isEmpty()) {
addCells(card.getCells());
int startOffset = mCells.indexOf(subCells.get(0));
int endOffset = mCells.indexOf(subCells.get(subCells.size() - 1));
Range range = Range.create(startOffset, endOffset);
mChildren.put(range, card);
}
}
示例4: getCardRange
import com.alibaba.android.vlayout.Range; //導入方法依賴的package包/類
@Override
public Range<Integer> getCardRange(String id) {
if (TextUtils.isEmpty(id)) {
return Range.create(0, 0);
}
List<Card> cards = getGroups();
for (int i = 0, size = cards.size(); i < size; i++) {
Card c = cards.get(i);
if (id.equals(c.id)) {
return getCardRange(c);
}
}
return Range.create(0, 0);
}
示例5: getCardRange
import com.alibaba.android.vlayout.Range; //導入方法依賴的package包/類
/**
*
* @param card
* @return card ragne of given instance
*/
public Range<Integer> getCardRange(Card card) {
if (card == null) return Range.create(0, 1);
int idx = getGroups().indexOf(card);
if (idx >= 0) {
return mCards.get(idx).first;
} else {
return Range.create(0, 1);
}
}