use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class DefaultLayoutAnimator method getItemsMovedAnimation.
protected AnimatorSet getItemsMovedAnimation(List<Pair<FreeFlowItem, Rect>> moved) {
AnimatorSet anim = new AnimatorSet();
ArrayList<Animator> moves = new ArrayList<Animator>();
for (Pair<FreeFlowItem, Rect> item : moved) {
FreeFlowItem proxy = FreeFlowItem.clone(item.first);
View v = proxy.view;
proxy.frame.left -= callback.getViewportLeft();
proxy.frame.top -= callback.getViewportTop();
proxy.frame.right -= callback.getViewportLeft();
proxy.frame.bottom -= callback.getViewportTop();
moves.add(transitionToFrame(item.second, proxy, v));
}
anim.playTogether(moves);
return anim;
}
use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class NoAnimationLayoutAnimator method animateChanges.
@Override
public void animateChanges(LayoutChangeset changes, FreeFlowContainer callback) {
this.changes = changes;
for (Pair<FreeFlowItem, Rect> item : changes.getMoved()) {
Rect r = item.first.frame;
View v = item.first.view;
int wms = MeasureSpec.makeMeasureSpec(r.right - r.left, MeasureSpec.EXACTLY);
int hms = MeasureSpec.makeMeasureSpec(r.bottom - r.top, MeasureSpec.EXACTLY);
v.measure(wms, hms);
v.layout(r.left, r.top, r.right, r.bottom);
}
callback.onLayoutChangeAnimationsCompleted(this);
}
use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class ArtbookLayout method prepareLayout.
@Override
public void prepareLayout() {
Log.d(TAG, "prepare layout!!!");
map = new HashMap<Object, FreeFlowItem>();
s = itemsAdapter.getSection(0);
int rowIndex;
Log.d(TAG, "prepare layout for: " + s.getDataCount());
for (int i = 0; i < s.getDataCount(); i++) {
rowIndex = i / 5;
FreeFlowItem p = new FreeFlowItem();
p.isHeader = false;
p.itemIndex = i;
p.itemSection = 0;
p.data = s.getDataAtIndex(i);
Rect r = new Rect();
switch(i % 5) {
case (0):
r.left = 0;
r.top = rowIndex * largeItemSide;
r.right = largeItemSide;
r.bottom = r.top + largeItemSide;
if (rowIndex % 2 != 0) {
r.offset(largeItemSide, 0);
}
break;
case (1):
r.left = largeItemSide;
r.right = largeItemSide + regularItemSide;
r.top = rowIndex * largeItemSide;
r.bottom = r.top + regularItemSide;
if (rowIndex % 2 != 0) {
r.offset(-largeItemSide, 0);
}
break;
case (2):
r.left = 3 * regularItemSide;
r.right = width;
r.top = rowIndex * largeItemSide;
r.bottom = r.top + regularItemSide;
if (rowIndex % 2 != 0) {
r.offset(-largeItemSide, 0);
}
break;
case (3):
r.left = largeItemSide;
r.right = largeItemSide + regularItemSide;
r.top = rowIndex * largeItemSide + regularItemSide;
r.bottom = r.top + regularItemSide;
if (rowIndex % 2 != 0) {
r.offset(-largeItemSide, 0);
}
break;
case (4):
r.left = 3 * regularItemSide;
r.right = width;
r.top = rowIndex * largeItemSide + regularItemSide;
r.bottom = r.top + regularItemSide;
if (rowIndex % 2 != 0) {
r.offset(-largeItemSide, 0);
}
break;
default:
break;
}
p.frame = r;
map.put(s.getDataAtIndex(i), p);
}
}
Aggregations