summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-03-06 19:36:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-03-06 19:36:49 +0000
commitaadd2758b042d7d2eb12839aecf9d1aedafbd104 (patch)
treeca5da82d0ccd37418203f4120a29192e10236bd1
parentf67276bd50417158cceda9eb0d87ad4c4462a61e (diff)
parentf4c5826ac14df34c42b210def5c7c9c311691795 (diff)
Merge "Fix contact tile horizontal animations when swiping shortcut card"
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java15
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java19
2 files changed, 13 insertions, 21 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 675a40f0d..354765f77 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -447,7 +447,8 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
if (itemViewType == PhoneFavoritesTileAdapter.ViewTypes.TOP) {
// This is a tiled row, so save horizontal offsets instead
saveHorizontalOffsets((ContactTileRow) child, (ArrayList<ContactEntry>)
- mAdapter.getItem(position), position);
+ mAdapter.getItem(position),
+ mAdapter.getAdjustedPositionInContactTileAdapter(position));
}
if (DEBUG) {
Log.d(TAG, "Saving itemId: " + itemId + " for listview child " + i + " Top: "
@@ -506,7 +507,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
int left = child.getLeft();
Integer startRow = mItemIdTopMap.get(itemId);
-
if (startRow != null) {
if (startRow > currentRow) {
// Item has shifted upwards to the previous row.
@@ -535,10 +535,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
animators.add(ObjectAnimator.ofFloat(
child, "translationX", delta, 0.0f));
}
- } else {
- // In case the last square row is pushed up from the non-square section.
- animators.add(ObjectAnimator.ofFloat(
- child, "translationX", left, 0.0f));
}
}
}
@@ -580,7 +576,7 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
// This is a tiled row, so perform horizontal animations instead
performHorizontalAnimations((ContactTileRow) child, (
ArrayList<ContactEntry>) mAdapter.getItem(position), idsInPlace,
- position);
+ mAdapter.getAdjustedPositionInContactTileAdapter(position));
}
final long itemId = mAdapter.getItemId(position);
@@ -610,11 +606,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
}
startTop = top + (i > 0 ? itemHeight : -itemHeight);
delta = startTop - top;
- } else {
- // In case the first non-square row is pushed down
- // from the square section.
- animators.add(ObjectAnimator.ofFloat(
- child, "alpha", 0.0f, 1.0f));
}
if (DEBUG) {
Log.d(TAG, "Found itemId: " + itemId + " for listview child " + i +
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index 7d5dba25e..e09fc7d41 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -144,7 +144,7 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
}
}
// Set position to the position of the actual favorite contact in the favorites adapter
- position = getAdjustedFavoritePosition(position, callLogAdapterCount);
+ position = getAdjustedPositionInContactTileAdapter(position);
return mContactTileAdapter.getItem(position);
}
@@ -176,7 +176,7 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
} else if (position < (callLogAdapterCount + mContactTileAdapter.getCount() +
getTeaserViewCount() + 1)) {
return mContactTileAdapter.getItemId(
- getAdjustedFavoritePosition(position, callLogAdapterCount));
+ getAdjustedPositionInContactTileAdapter(position));
} else {
// Default fallback. We don't normally get here.
return FAVORITES_MENU_ITEM_ID;
@@ -216,7 +216,7 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
return mContactTileAdapter.getViewTypeCount() + 3;
} else if (position < getCount()) {
return mContactTileAdapter.getItemViewType(
- getAdjustedFavoritePosition(position, callLogAdapterCount));
+ getAdjustedPositionInContactTileAdapter(position));
} else {
// Catch-all - we shouldn't get here but if we do use the same as the favorites menu.
return mContactTileAdapter.getViewTypeCount() + 3;
@@ -269,7 +269,7 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
// Set position to the position of the actual favorite contact in the favorites adapter.
// Adjusts based on the presence of other views, such as the favorites menu.
- position = getAdjustedFavoritePosition(position, callLogAdapterCount);
+ position = getAdjustedPositionInContactTileAdapter(position);
// Favorites section
final View view = mContactTileAdapter.getView(position, convertView, parent);
@@ -296,18 +296,19 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
return mCallLogAdapter.isEnabled(position);
} else { // For favorites section
return mContactTileAdapter.isEnabled(
- getAdjustedFavoritePosition(position, callLogAdapterCount));
+ getAdjustedPositionInContactTileAdapter(position));
}
}
/**
- * Determines the index into the mContactTileAdapter for the current position.
+ * Given the current position in the merged adapter, return the index in the
+ * mContactTileAdapter this position corresponds to.
*
- * @param position current position in the overall adapter.
- * @param callLogAdapterCount number of entries in "last calls" list (ie 0 or 1).
+ * @param position current position in the overall (merged) adapter.
* @return position in the mContactTileAdapter.
*/
- private int getAdjustedFavoritePosition(int position, int callLogAdapterCount) {
+ public int getAdjustedPositionInContactTileAdapter(int position) {
+ final int callLogAdapterCount = mCallLogAdapter.getCount();
if (position - callLogAdapterCount > TILE_INTERACTION_TEASER_VIEW_POSITION &&
mTileInteractionTeaserView.getShouldDisplayInList()) {
return position - callLogAdapterCount - 2;