Class CacheHelper
-
- All Implemented Interfaces:
public class CacheHelperCache of the item sizes and of the resulting lines (item count, total width etc.), so that com.xiaofeng.flowlayoutmanager.FlowLayoutManager does not have to lay out every item from the beginning when scrolling. Used internally by the layout manager.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intNOT_FOUND
-
Constructor Summary
Constructors Constructor Description CacheHelper(int itemsPerLine, int contentAreaWidth)
-
Method Summary
Modifier and Type Method Description voidadd(int startIndex, Array<Point> sizes)Add measured items into cache voidadd(int startIndex, int count)Make space for {@param count} items voidinvalidSizes(int index, int count)Sizes has been changed and new sizes not available yet, just remove them from cache The line map will also be invalidate after the invalidated items voidremove(int index, int count)voidsetItem(int index, Point newSize)voidmove(int from, int to, int count)Move items from one place to another. Array<int>getLineMap()intitemLineIndex(int itemIndex)LinecontainingLine(int itemIndex)intfirstItemIndex(int lineIndex)LinegetLine(int lineIndex)booleanhasPreviousLineCached(int itemIndex)booleanhasNextLineCached(int itemIndex)voidclear()voidcontentAreaWidth(int width)intcontentAreaWidth()booleanvalid()voidstartBatchSetting()voidendBatchSetting()-
-
Method Detail
-
add
void add(int startIndex, int count)
Make space for {@param count} items
-
invalidSizes
void invalidSizes(int index, int count)
Sizes has been changed and new sizes not available yet, just remove them from cache The line map will also be invalidate after the invalidated items
-
remove
void remove(int index, int count)
-
move
void move(int from, int to, int count)
Move items from one place to another. no check on parameter as invoker will make sure it is correct
-
getLineMap
Array<int> getLineMap()
-
itemLineIndex
int itemLineIndex(int itemIndex)
-
containingLine
Line containingLine(int itemIndex)
-
firstItemIndex
int firstItemIndex(int lineIndex)
-
hasPreviousLineCached
boolean hasPreviousLineCached(int itemIndex)
-
hasNextLineCached
boolean hasNextLineCached(int itemIndex)
-
clear
void clear()
-
contentAreaWidth
void contentAreaWidth(int width)
-
contentAreaWidth
int contentAreaWidth()
-
valid
boolean valid()
-
startBatchSetting
void startBatchSetting()
-
endBatchSetting
void endBatchSetting()
-
-
-
-