diff --git a/.gitignore b/.gitignore
index aed7fb2..6a25065 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,12 @@ examples/PhotoGrid/bin/*
*.iml
out
gen
+
+# Gradle files
+.gradle/
+build/
+*/reports/*
+# Local configuration file (sdk path, etc)
+local.properties
+
+.DS_Store
diff --git a/Comcast Contributor License Agreement (03-07-14).pdf b/Comcast Contributor License Agreement (03-07-14).pdf
new file mode 100644
index 0000000..7874123
Binary files /dev/null and b/Comcast Contributor License Agreement (03-07-14).pdf differ
diff --git a/FreeFlow/.classpath b/FreeFlow/.classpath
new file mode 100644
index 0000000..5176974
--- /dev/null
+++ b/FreeFlow/.classpath
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/FreeFlow/.settings/org.eclipse.jdt.core.prefs b/FreeFlow/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b080d2d
--- /dev/null
+++ b/FreeFlow/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/FreeFlow/AndroidManifest.xml b/FreeFlow/AndroidManifest.xml
index 56c3bb6..35c8afb 100644
--- a/FreeFlow/AndroidManifest.xml
+++ b/FreeFlow/AndroidManifest.xml
@@ -20,15 +20,9 @@
android:versionName="1.0" >
+ android:minSdkVersion="14"
+ android:targetSdkVersion="21" />
-
-
+
diff --git a/FreeFlow/FreeFlow.iml b/FreeFlow/FreeFlow.iml
new file mode 100644
index 0000000..eccf30a
--- /dev/null
+++ b/FreeFlow/FreeFlow.iml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeFlow/build.gradle b/FreeFlow/build.gradle
new file mode 100644
index 0000000..1e0bdc5
--- /dev/null
+++ b/FreeFlow/build.gradle
@@ -0,0 +1,32 @@
+buildscript {
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.1.0'
+ }
+}
+apply plugin: 'com.android.library'
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+dependencies {
+ compile 'com.android.support:support-v4:21.0.2'
+}
+android {
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ }
+ }
+}
+android {
+ compileSdkVersion 21
+ buildToolsVersion '21.1.2'
+}
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+apply from: '../maven_push.gradle'
diff --git a/FreeFlow/gradle.properties b/FreeFlow/gradle.properties
new file mode 100644
index 0000000..dc64b2c
--- /dev/null
+++ b/FreeFlow/gradle.properties
@@ -0,0 +1,17 @@
+VERSION_NAME=1.0
+VERSION_CODE=1
+GROUP=com.comcast.freeflow
+POM_DESCRIPTION=FreeFlow Layout Library for Android
+POM_URL=https://github.com/Comcast/FreeFlow
+POM_SCM_URL=https://github.com/Comcast/FreeFlow
+POM_SCM_CONNECTION=scm:git@github.com:comcast/freeflow.git
+POM_SCM_DEV_CONNECTION=scm:git@github.com:comcast/comcast/freeflow.git
+POM_LICENCE_NAME=The Apache Software License, Version 2.0
+POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
+POM_LICENCE_DIST=repo
+POM_DEVELOPER_ID=Comcast
+POM_DEVELOPER_NAME=Arpit Mathur
+POM_NAME=FreeFlow Layout Library
+POM_ARTIFACT_ID=freeflow
+POM_PACKAGING=aar
+
diff --git a/FreeFlow/res/drawable-hdpi/ic_launcher.png b/FreeFlow/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e..0000000
Binary files a/FreeFlow/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/FreeFlow/res/drawable-mdpi/ic_launcher.png b/FreeFlow/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047d..0000000
Binary files a/FreeFlow/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/FreeFlow/res/drawable-xhdpi/ic_launcher.png b/FreeFlow/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d76..0000000
Binary files a/FreeFlow/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/FreeFlow/res/layout/activity_main.xml b/FreeFlow/res/layout/activity_main.xml
deleted file mode 100644
index fed629c..0000000
--- a/FreeFlow/res/layout/activity_main.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
diff --git a/FreeFlow/res/menu/main.xml b/FreeFlow/res/menu/main.xml
deleted file mode 100644
index 110b8d3..0000000
--- a/FreeFlow/res/menu/main.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
diff --git a/FreeFlow/res/values-sw600dp/dimens.xml b/FreeFlow/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 37f8dc3..0000000
--- a/FreeFlow/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
diff --git a/FreeFlow/res/values-sw720dp-land/dimens.xml b/FreeFlow/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index bf389d5..0000000
--- a/FreeFlow/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- 128dp
-
-
diff --git a/FreeFlow/res/values-v11/styles.xml b/FreeFlow/res/values-v11/styles.xml
deleted file mode 100644
index 63f281a..0000000
--- a/FreeFlow/res/values-v11/styles.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
diff --git a/FreeFlow/res/values-v14/styles.xml b/FreeFlow/res/values-v14/styles.xml
deleted file mode 100644
index 52dec45..0000000
--- a/FreeFlow/res/values-v14/styles.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
diff --git a/FreeFlow/res/values/dimens.xml b/FreeFlow/res/values/dimens.xml
deleted file mode 100644
index 8987eb3..0000000
--- a/FreeFlow/res/values/dimens.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- 16dp
- 16dp
-
-
diff --git a/FreeFlow/res/values/strings.xml b/FreeFlow/res/values/strings.xml
deleted file mode 100644
index 9682c8a..0000000
--- a/FreeFlow/res/values/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
- FreeFlow
- Settings
- Hello world!
-
-
diff --git a/FreeFlow/res/values/styles.xml b/FreeFlow/res/values/styles.xml
deleted file mode 100644
index cd0a399..0000000
--- a/FreeFlow/res/values/styles.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/FreeFlow/src/com/comcast/freeflow/animations/DefaultLayoutAnimator.java b/FreeFlow/src/com/comcast/freeflow/animations/DefaultLayoutAnimator.java
index 0d10174..801bce6 100644
--- a/FreeFlow/src/com/comcast/freeflow/animations/DefaultLayoutAnimator.java
+++ b/FreeFlow/src/com/comcast/freeflow/animations/DefaultLayoutAnimator.java
@@ -18,10 +18,9 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.List;
-import com.comcast.freeflow.core.FreeFlowContainer;
-import com.comcast.freeflow.core.FreeFlowItem;
-import com.comcast.freeflow.core.LayoutChangeset;
+//import org.freeflow.BuildConfig;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
@@ -32,10 +31,15 @@
import android.graphics.Rect;
import android.util.Log;
import android.util.Pair;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.animation.DecelerateInterpolator;
+import com.comcast.freeflow.core.FreeFlowContainer;
+import com.comcast.freeflow.core.FreeFlowItem;
+import com.comcast.freeflow.core.LayoutChangeset;
+
public class DefaultLayoutAnimator implements FreeFlowLayoutAnimator {
protected LayoutChangeset changeSet;
@@ -97,7 +101,17 @@ public void cancel() {
if (movingSet != null)
movingSet.cancel();
+ for (FreeFlowItem item : changeSet.getAdded()) {
+ item.view.setAlpha(1f);
+ }
+ for (FreeFlowItem item : changeSet.getRemoved()) {
+ item.view.setAlpha(1f);
+ }
+
mIsRunning = false;
+
+
+
}
@@ -107,9 +121,6 @@ public void cancel() {
public void animateChanges(LayoutChangeset changeSet, final FreeFlowContainer callback) {
this.changeSet = changeSet;
this.callback = callback;
-
- Log.d(TAG, "Changes: " + changeSet.toString());
-
cancel();
mIsRunning = true;
@@ -126,13 +137,13 @@ public int compare(FreeFlowItem lhs, FreeFlowItem rhs) {
}
};
- ArrayList removed = changeSet.getRemoved();
+ List removed = changeSet.getRemoved();
if (removed.size() > 0) {
Collections.sort(removed, cmp);
disappearingSet = getItemsRemovedAnimation(changeSet.getRemoved());
}
- ArrayList added = changeSet.getAdded();
+ List added = changeSet.getAdded();
if (added.size() > 0) {
Collections.sort(added, cmp);
appearingSet = getItemsAddedAnimation(added);
@@ -181,7 +192,7 @@ public void onAnimationCancel(Animator animation) {
* An ArrayList of FreeFlowItems
removed
* @return The AnimatorSet of the removed objects
*/
- protected AnimatorSet getItemsRemovedAnimation(ArrayList removed) {
+ protected AnimatorSet getItemsRemovedAnimation(List removed) {
AnimatorSet disappearingSet = new AnimatorSet();
ArrayList fades = new ArrayList();
for (FreeFlowItem proxy : removed) {
@@ -201,7 +212,7 @@ protected AnimatorSet getItemsRemovedAnimation(ArrayList removed)
/**
*
*/
- protected AnimatorSet getItemsAddedAnimation(ArrayList added) {
+ protected AnimatorSet getItemsAddedAnimation(List added) {
AnimatorSet appearingSet = new AnimatorSet();
ArrayList fadeIns = new ArrayList();
for (FreeFlowItem proxy : added) {
@@ -245,7 +256,7 @@ protected AnimatorSet getAnimationSequence() {
return allAnim;
}
- protected AnimatorSet getItemsMovedAnimation(ArrayList> moved) {
+ protected AnimatorSet getItemsMovedAnimation(List> moved) {
AnimatorSet anim = new AnimatorSet();
ArrayList moves = new ArrayList();
@@ -258,9 +269,6 @@ protected AnimatorSet getItemsMovedAnimation(ArrayList>
proxy.frame.right -= callback.getViewportLeft();
proxy.frame.bottom -= callback.getViewportTop();
- // Log.d(TAG, "vpx = " + callback.viewPortX + ", vpy = " +
- // callback.viewPortY);
-
moves.add(transitionToFrame(item.second, proxy, v));
}
@@ -273,9 +281,6 @@ protected AnimatorSet getItemsMovedAnimation(ArrayList>
public ValueAnimator transitionToFrame(final Rect of, final FreeFlowItem nf, final View v) {
ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
anim.setDuration(cellPositionTransitionAnimationDuration);
-//
-// Log.d(TAG, "of width = " + of.width() + ", nf width = " + nf.frame.width());
-// Log.d(TAG, "of height = " + of.height() + ", nf height = " + nf.frame.height());
anim.addUpdateListener(new AnimatorUpdateListener() {
@@ -311,7 +316,9 @@ public void onAnimationUpdate(ValueAnimator animation) {
// v.setAlpha((1 - alpha) * animation.getAnimatedFraction()
// + alpha);
} catch (NullPointerException e) {
- Log.e(TAG, "Nullpointer exception");
+ // if(BuildConfig.DEBUG){
+ // Log.e(TAG, "Nullpointer exception");
+ // }
e.printStackTrace();
animation.cancel();
}
@@ -337,4 +344,9 @@ public boolean isRunning() {
return mIsRunning;
}
+ @Override
+ public void onContainerTouchDown(MotionEvent event) {
+ cancel();
+ }
+
}
diff --git a/FreeFlow/src/com/comcast/freeflow/animations/FreeFlowLayoutAnimator.java b/FreeFlow/src/com/comcast/freeflow/animations/FreeFlowLayoutAnimator.java
index 8431bd7..8938898 100644
--- a/FreeFlow/src/com/comcast/freeflow/animations/FreeFlowLayoutAnimator.java
+++ b/FreeFlow/src/com/comcast/freeflow/animations/FreeFlowLayoutAnimator.java
@@ -15,6 +15,8 @@
******************************************************************************/
package com.comcast.freeflow.animations;
+import android.view.MotionEvent;
+
import com.comcast.freeflow.core.FreeFlowContainer;
import com.comcast.freeflow.core.LayoutChangeset;
@@ -48,11 +50,21 @@ public interface FreeFlowLayoutAnimator {
* The Container instance to be informed when your animations are
* complete
*/
- public void animateChanges(LayoutChangeset changes, FreeFlowContainer callback);
+ public void animateChanges(LayoutChangeset changes,
+ FreeFlowContainer callback);
/**
* @return Whether the layout animation is currently playing
*/
public boolean isRunning();
+ /**
+ * Called when a touch down event occurs while the layoutAnimator is
+ * animating. It gives you the first chance to exit or complete the
+ * animation since the Container might be about to be scrolled
+ *
+ * @param event The MotionEvent received by the Container
+ */
+ public void onContainerTouchDown(MotionEvent event);
+
}
diff --git a/FreeFlow/src/com/comcast/freeflow/animations/NoAnimationLayoutAnimator.java b/FreeFlow/src/com/comcast/freeflow/animations/NoAnimationLayoutAnimator.java
new file mode 100644
index 0000000..a4730a0
--- /dev/null
+++ b/FreeFlow/src/com/comcast/freeflow/animations/NoAnimationLayoutAnimator.java
@@ -0,0 +1,53 @@
+package com.comcast.freeflow.animations;
+
+import android.graphics.Rect;
+import android.util.Pair;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.MeasureSpec;
+
+import com.comcast.freeflow.core.FreeFlowContainer;
+import com.comcast.freeflow.core.FreeFlowItem;
+import com.comcast.freeflow.core.LayoutChangeset;
+
+public class NoAnimationLayoutAnimator implements FreeFlowLayoutAnimator {
+
+ private LayoutChangeset changes;
+
+ @Override
+ public LayoutChangeset getChangeSet() {
+ return changes;
+ }
+
+ @Override
+ public void cancel() {
+
+ }
+
+ @Override
+ public void animateChanges(LayoutChangeset changes,
+ FreeFlowContainer callback) {
+ this.changes = changes;
+ for(Pair 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);
+
+ }
+
+ @Override
+ public boolean isRunning() {
+ return false;
+ }
+
+ @Override
+ public void onContainerTouchDown(MotionEvent event) {
+ cancel();
+ }
+
+}
diff --git a/FreeFlow/src/com/comcast/freeflow/animations/interpolators/EaseInOutQuintInterpolator.java b/FreeFlow/src/com/comcast/freeflow/animations/interpolators/EaseInOutQuintInterpolator.java
new file mode 100644
index 0000000..390c4a4
--- /dev/null
+++ b/FreeFlow/src/com/comcast/freeflow/animations/interpolators/EaseInOutQuintInterpolator.java
@@ -0,0 +1,15 @@
+package com.comcast.freeflow.animations.interpolators;
+
+import android.view.animation.Interpolator;
+
+public class EaseInOutQuintInterpolator implements Interpolator{
+
+ // easeInOutQuint
+ public float getInterpolation(float t) {
+ float x = t*2.0f;
+ if (t<0.5f) return 0.5f*x*x*x*x*x;
+ x = (t-0.5f)*2-1;
+ return 0.5f*x*x*x*x*x+1;
+ }
+
+}
diff --git a/FreeFlow/src/com/comcast/freeflow/core/AbsLayoutContainer.java b/FreeFlow/src/com/comcast/freeflow/core/AbsLayoutContainer.java
index 3021a04..218e805 100644
--- a/FreeFlow/src/com/comcast/freeflow/core/AbsLayoutContainer.java
+++ b/FreeFlow/src/com/comcast/freeflow/core/AbsLayoutContainer.java
@@ -33,7 +33,7 @@
public abstract class AbsLayoutContainer extends ViewGroup {
- protected HashMap