Skip to content

Commit

Permalink
Fixes Comcast#27
Browse files Browse the repository at this point in the history
  • Loading branch information
arpit committed Feb 28, 2014
1 parent c16dda5 commit 3b6cf0b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

public abstract class AbsLayoutContainer extends ViewGroup {

protected HashMap<Object, FreeFlowItem> frames = null;
protected Map<Object, FreeFlowItem> frames = null;

protected ArrayList<FreeFlowEventListener> listeners = new ArrayList<FreeFlowEventListener>();

Expand Down
16 changes: 8 additions & 8 deletions FreeFlow/src/com/comcast/freeflow/core/FreeFlowContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ protected void computeLayout(int w, int h) {
if (shouldRecalculateScrollWhenComputingLayout) {
computeViewPort(layout);
}
HashMap<Object, FreeFlowItem> oldFrames = frames;
Map<Object, FreeFlowItem> oldFrames = frames;

frames = new HashMap<Object, FreeFlowItem>();
copyFrames(layout.getItemProxies(viewPortX, viewPortY), frames);
Expand All @@ -288,8 +288,8 @@ protected void computeLayout(int w, int h) {
* Copies the frames from one HashMap into another. The items are cloned
* cause we modify the rectangles of the items as they are moving
*/
protected void copyFrames(HashMap<Object, FreeFlowItem> srcFrames,
HashMap<Object, FreeFlowItem> destFrames) {
protected void copyFrames(Map<Object, FreeFlowItem> srcFrames,
Map<Object, FreeFlowItem> destFrames) {
Iterator<?> it = srcFrames.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<?, ?> pairs = (Map.Entry<?, ?>) it.next();
Expand Down Expand Up @@ -563,14 +563,14 @@ public void onLayoutChangeAnimationsCompleted(FreeFlowLayoutAnimator anim) {
}

public LayoutChangeset getViewChanges(
HashMap<Object, FreeFlowItem> oldFrames,
HashMap<Object, FreeFlowItem> newFrames) {
Map<Object, FreeFlowItem> oldFrames,
Map<Object, FreeFlowItem> newFrames) {
return getViewChanges(oldFrames, newFrames, false);
}

public LayoutChangeset getViewChanges(
HashMap<Object, FreeFlowItem> oldFrames,
HashMap<Object, FreeFlowItem> newFrames, boolean moveEvenIfSame) {
Map<Object, FreeFlowItem> oldFrames,
Map<Object, FreeFlowItem> newFrames, boolean moveEvenIfSame) {

// cleanupViews();
LayoutChangeset change = new LayoutChangeset();
Expand Down Expand Up @@ -1156,7 +1156,7 @@ public FreeFlowLayoutAnimator getLayoutAnimator() {
return layoutAnimator;
}

public HashMap<Object, FreeFlowItem> getFrames() {
public Map<Object, FreeFlowItem> getFrames() {
return frames;
}

Expand Down
5 changes: 2 additions & 3 deletions FreeFlow/src/com/comcast/freeflow/layouts/FreeFlowLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
******************************************************************************/
package com.comcast.freeflow.layouts;

import java.util.HashMap;
import java.util.Map;

import com.comcast.freeflow.animations.FreeFlowLayoutAnimator;
import com.comcast.freeflow.core.FreeFlowItem;
import com.comcast.freeflow.core.SectionedAdapter;

Expand Down Expand Up @@ -64,7 +63,7 @@ public interface FreeFlowLayout {
* @return HashMap of Data to itemProxies All itemProxies returned will be
* renedered, sized, laid out, and animated
*/
public HashMap<Object, FreeFlowItem> getItemProxies(int viewPortLeft,
public Map<Object, FreeFlowItem> getItemProxies(int viewPortLeft,
int viewPortTop);

public void setLayoutParams(FreeFlowLayoutParams params);
Expand Down
3 changes: 2 additions & 1 deletion FreeFlow/src/com/comcast/freeflow/layouts/HGridLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.comcast.freeflow.layouts;

import java.util.HashMap;
import java.util.Map;

import com.comcast.freeflow.core.FreeFlowItem;
import com.comcast.freeflow.core.Section;
Expand All @@ -31,7 +32,7 @@ public class HGridLayout extends FreeFlowLayoutBase implements FreeFlowLayout {
private static final String TAG = "HGridLayout";
private int itemHeight = -1;
private int itemWidth = -1;
private HashMap<Object, FreeFlowItem> proxies = new HashMap<Object, FreeFlowItem>();
private Map<Object, FreeFlowItem> proxies = new HashMap<Object, FreeFlowItem>();
private int headerWidth = -1;
private int headerHeight = -1;
private int cellBufferSize = 0;
Expand Down
5 changes: 3 additions & 2 deletions FreeFlow/src/com/comcast/freeflow/layouts/HLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.comcast.freeflow.layouts;

import java.util.HashMap;
import java.util.Map;

import com.comcast.freeflow.core.FreeFlowItem;
import com.comcast.freeflow.core.Section;
Expand All @@ -31,7 +32,7 @@ public class HLayout extends FreeFlowLayoutBase implements FreeFlowLayout {

private static final String TAG = "HLayout";
private int itemWidth = -1;
private HashMap<Object, FreeFlowItem> proxies = new HashMap<Object, FreeFlowItem>();
private Map<Object, FreeFlowItem> proxies = new HashMap<Object, FreeFlowItem>();
private int headerHeight = -1;
private int headerWidth = -1;

Expand Down Expand Up @@ -120,7 +121,7 @@ public void prepareLayout() {
*
*/
@Override
public HashMap<Object, FreeFlowItem> getItemProxies(int viewPortLeft, int viewPortTop) {
public Map<Object, FreeFlowItem> getItemProxies(int viewPortLeft, int viewPortTop) {
HashMap<Object, FreeFlowItem> desc = new HashMap<Object, FreeFlowItem>();

for (FreeFlowItem fd : proxies.values()) {
Expand Down
11 changes: 5 additions & 6 deletions FreeFlow/src/com/comcast/freeflow/layouts/VGridLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
package com.comcast.freeflow.layouts;

import java.util.HashMap;
import java.util.Map;

import android.graphics.Rect;

import com.comcast.freeflow.core.FreeFlowItem;
import com.comcast.freeflow.core.Section;
import com.comcast.freeflow.core.SectionedAdapter;
import com.comcast.freeflow.layouts.FreeFlowLayout.FreeFlowLayoutParams;
import com.comcast.freeflow.utils.ViewUtils;

import android.graphics.Rect;

public class VGridLayout extends FreeFlowLayoutBase implements FreeFlowLayout {

private static final String TAG = "VGridLayout";
Expand All @@ -33,7 +32,7 @@ public class VGridLayout extends FreeFlowLayoutBase implements FreeFlowLayout {
protected int headerWidth = -1;
protected int headerHeight = -1;

protected HashMap<Object, FreeFlowItem> proxies = new HashMap<Object, FreeFlowItem>();
protected Map<Object, FreeFlowItem> proxies = new HashMap<Object, FreeFlowItem>();

private int cellBufferSize = 0;
private int bufferCount = 1;
Expand Down Expand Up @@ -132,7 +131,7 @@ public void prepareLayout() {
*
*/
@Override
public HashMap<Object, FreeFlowItem> getItemProxies(int viewPortLeft, int viewPortTop) {
public Map<Object, FreeFlowItem> getItemProxies(int viewPortLeft, int viewPortTop) {
HashMap<Object, FreeFlowItem> desc = new HashMap<Object, FreeFlowItem>();
for (FreeFlowItem fd : proxies.values()) {
if (fd.frame.top + itemHeight > viewPortTop - cellBufferSize
Expand Down
4 changes: 2 additions & 2 deletions FreeFlow/src/com/comcast/freeflow/utils/ViewUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
******************************************************************************/
package com.comcast.freeflow.utils;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import com.comcast.freeflow.core.FreeFlowItem;

public class ViewUtils {
public static FreeFlowItem getItemAt(HashMap<? extends Object, FreeFlowItem> frameDescriptors, int x, int y){
public static FreeFlowItem getItemAt(Map<? extends Object, FreeFlowItem> frameDescriptors, int x, int y){

Iterator<? extends Object> it= frameDescriptors.entrySet().iterator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package com.comcast.freeflow.layouts;

import java.util.HashMap;
import java.util.Map;

import com.comcast.freeflow.helpers.DefaultSectionAdapter;
import com.comcast.freeflow.teststub.MainActivity;

import com.comcast.freeflow.core.FreeFlowItem;

import android.test.ActivityInstrumentationTestCase2;
Expand All @@ -39,7 +39,7 @@ public void testGridLayoutMath(){
vGrid.setDimensions(600, 1000);
vGrid.prepareLayout();

HashMap<? extends Object , FreeFlowItem> map ;
Map<? extends Object , FreeFlowItem> map ;
map = vGrid.getItemProxies(0, 0);

assertEquals("VGridLayout did not generate correct number of frames", 5, map.size());
Expand Down

0 comments on commit 3b6cf0b

Please sign in to comment.