use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class HLayout method getContentWidth.
@Override
public int getContentWidth() {
if (itemsAdapter == null || itemsAdapter.getNumberOfSections() <= 0) {
return 0;
}
int sectionIndex = itemsAdapter.getNumberOfSections() - 1;
Section s = itemsAdapter.getSection(sectionIndex);
if (s.getDataCount() == 0)
return 0;
Object lastFrameData = s.getDataAtIndex(s.getDataCount() - 1);
FreeFlowItem fd = proxies.get(lastFrameData);
return (fd.frame.left + fd.frame.width());
}
use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class VGridLayout method getContentHeight.
@Override
public int getContentHeight() {
if (itemsAdapter == null || itemsAdapter.getNumberOfSections() <= 0) {
return 0;
}
int sectionIndex = itemsAdapter.getNumberOfSections() - 1;
Section s = itemsAdapter.getSection(sectionIndex);
if (s.getDataCount() == 0)
return 0;
Object lastFrameData = s.getDataAtIndex(s.getDataCount() - 1);
FreeFlowItem fd = proxies.get(lastFrameData);
if (fd == null) {
return 0;
}
return (fd.frame.top + fd.frame.height());
}
use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class DefaultLayoutAnimator method getItemsAddedAnimation.
/**
*
*/
protected AnimatorSet getItemsAddedAnimation(List<FreeFlowItem> added) {
AnimatorSet appearingSet = new AnimatorSet();
ArrayList<Animator> fadeIns = new ArrayList<Animator>();
for (FreeFlowItem proxy : added) {
proxy.view.setAlpha(0);
fadeIns.add(ObjectAnimator.ofFloat(proxy.view, "alpha", 1));
}
if (animateIndividualCellsSequentially)
appearingSet.playSequentially(fadeIns);
else
appearingSet.playTogether(fadeIns);
appearingSet.setStartDelay(newCellsAdditionAnimationStartDelay);
appearingSet.setDuration(newCellsAdditionAnimationDurationPerCell);
return appearingSet;
}
use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class DefaultLayoutAnimator method animateChanges.
@Override
public void animateChanges(LayoutChangeset changeSet, final FreeFlowContainer callback) {
this.changeSet = changeSet;
this.callback = callback;
cancel();
mIsRunning = true;
disappearingSet = null;
appearingSet = null;
movingSet = null;
Comparator<FreeFlowItem> cmp = new Comparator<FreeFlowItem>() {
@Override
public int compare(FreeFlowItem lhs, FreeFlowItem rhs) {
return (lhs.itemSection * 1000 + lhs.itemIndex) - (rhs.itemSection * 1000 + rhs.itemIndex);
}
};
List<FreeFlowItem> removed = changeSet.getRemoved();
if (removed.size() > 0) {
Collections.sort(removed, cmp);
disappearingSet = getItemsRemovedAnimation(changeSet.getRemoved());
}
List<FreeFlowItem> added = changeSet.getAdded();
if (added.size() > 0) {
Collections.sort(added, cmp);
appearingSet = getItemsAddedAnimation(added);
}
if (changeSet.getMoved().size() > 0) {
movingSet = getItemsMovedAnimation(changeSet.getMoved());
}
AnimatorSet all = getAnimationSequence();
if (all == null) {
mIsRunning = false;
callback.onLayoutChangeAnimationsCompleted(this);
} else {
all.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
mIsRunning = false;
callback.onLayoutChangeAnimationsCompleted(DefaultLayoutAnimator.this);
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
all.start();
}
}
use of com.comcast.freeflow.core.FreeFlowItem in project FreeFlow by Comcast.
the class DefaultLayoutAnimator method getItemsRemovedAnimation.
/**
* The animation to run on the items being removed
*
* @param removed
* An ArrayList of <code>FreeFlowItems</code> removed
* @return The AnimatorSet of the removed objects
*/
protected AnimatorSet getItemsRemovedAnimation(List<FreeFlowItem> removed) {
AnimatorSet disappearingSet = new AnimatorSet();
ArrayList<Animator> fades = new ArrayList<Animator>();
for (FreeFlowItem proxy : removed) {
fades.add(ObjectAnimator.ofFloat(proxy.view, "alpha", 0));
}
disappearingSet.setDuration(oldCellsRemovalAnimationDuration);
disappearingSet.setStartDelay(oldCellsRemovalAnimationStartDelay);
if (animateIndividualCellsSequentially)
disappearingSet.playSequentially(fades);
else
disappearingSet.playTogether(fades);
return disappearingSet;
}
Aggregations