diff options
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoriteFragment.java | 15 | ||||
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java | 19 |
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 79dbe8c49..7b4ff9f9a 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 1c871e82f..546367071 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; |