Loading res/layout/group_browse_list_item.xml +4 −8 Original line number Diff line number Diff line Loading @@ -86,26 +86,22 @@ android:id="@+id/icon_1" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:layout_marginRight="1dip" android:src="@drawable/ic_contact_picture" /> android:layout_marginRight="1dip" /> <ImageView android:id="@+id/icon_2" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:src="@drawable/ic_contact_picture" /> android:layout_height="@dimen/group_list_icon_size" /> </TableRow> <TableRow> <ImageView android:id="@+id/icon_3" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:layout_marginRight="1dip" android:src="@drawable/ic_contact_picture" /> android:layout_marginRight="1dip" /> <ImageView android:id="@+id/icon_4" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:src="@drawable/ic_contact_picture" /> android:layout_height="@dimen/group_list_icon_size" /> </TableRow> </TableLayout> Loading src/com/android/contacts/ContactPhotoManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ public abstract class ContactPhotoManager { */ public abstract void loadPhoto(ImageView view, Uri photoUri); /** * Remove photo from the supplied image view. This also cancels current pending load request * inside this photo manager. */ public abstract void removePhoto(ImageView view); /** * Temporarily stops loading photos from the database. */ Loading Loading @@ -260,6 +266,12 @@ class ContactPhotoManagerImpl extends ContactPhotoManager implements Callback { } } @Override public void removePhoto(ImageView view) { view.setImageDrawable(null); mPendingRequests.remove(view); } @Override public void refreshCache() { for (BitmapHolder holder : mBitmapHolderCache.snapshot().values()) { Loading src/com/android/contacts/group/GroupBrowseListAdapter.java +11 −5 Original line number Diff line number Diff line Loading @@ -153,8 +153,11 @@ public class GroupBrowseListAdapter extends BaseAdapter { if (currentGroupId == mGroupId) { final ImageView[] children = getIconViewsSordedByFillOrder(icons); for (int i = 0; i < children.length; i++) { final long photoId = i < photoIds.size() ? photoIds.get(i) : 0; mContactPhotoManager.loadPhoto(children[i], photoId); if (i < photoIds.size()) { mContactPhotoManager.loadPhoto(children[i], photoIds.get(i)); } else { mContactPhotoManager.removePhoto(children[i]); } } } } Loading Loading @@ -318,13 +321,16 @@ public class GroupBrowseListAdapter extends BaseAdapter { if (photoIds != null) { // Cache is available. Let the photo manager load those IDs. for (int i = 0; i < children.length; i++) { final long photoId = i < photoIds.size() ? photoIds.get(i) : 0; mContactPhotoManager.loadPhoto(children[i], photoId); if (i < photoIds.size()) { mContactPhotoManager.loadPhoto(children[i], photoIds.get(i)); } else { mContactPhotoManager.removePhoto(children[i]); } } } else { // Cache is not available. Load photo IDs asynchronously. for (ImageView child : children) { mContactPhotoManager.loadPhoto(child, 0); mContactPhotoManager.removePhoto(child); } new AsyncPhotoIdLoadTask().execute( new AsyncPhotoIdLoadArg(icons, entry.getGroupId(), Loading tests/src/com/android/contacts/tests/mocks/MockContactPhotoManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,11 @@ public class MockContactPhotoManager extends ContactPhotoManager { view.setImageResource(mDefaultResourceId); } @Override public void removePhoto(ImageView view) { view.setImageDrawable(null); } @Override public void pause() { } Loading Loading
res/layout/group_browse_list_item.xml +4 −8 Original line number Diff line number Diff line Loading @@ -86,26 +86,22 @@ android:id="@+id/icon_1" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:layout_marginRight="1dip" android:src="@drawable/ic_contact_picture" /> android:layout_marginRight="1dip" /> <ImageView android:id="@+id/icon_2" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:src="@drawable/ic_contact_picture" /> android:layout_height="@dimen/group_list_icon_size" /> </TableRow> <TableRow> <ImageView android:id="@+id/icon_3" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:layout_marginRight="1dip" android:src="@drawable/ic_contact_picture" /> android:layout_marginRight="1dip" /> <ImageView android:id="@+id/icon_4" android:layout_width="@dimen/group_list_icon_size" android:layout_height="@dimen/group_list_icon_size" android:src="@drawable/ic_contact_picture" /> android:layout_height="@dimen/group_list_icon_size" /> </TableRow> </TableLayout> Loading
src/com/android/contacts/ContactPhotoManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ public abstract class ContactPhotoManager { */ public abstract void loadPhoto(ImageView view, Uri photoUri); /** * Remove photo from the supplied image view. This also cancels current pending load request * inside this photo manager. */ public abstract void removePhoto(ImageView view); /** * Temporarily stops loading photos from the database. */ Loading Loading @@ -260,6 +266,12 @@ class ContactPhotoManagerImpl extends ContactPhotoManager implements Callback { } } @Override public void removePhoto(ImageView view) { view.setImageDrawable(null); mPendingRequests.remove(view); } @Override public void refreshCache() { for (BitmapHolder holder : mBitmapHolderCache.snapshot().values()) { Loading
src/com/android/contacts/group/GroupBrowseListAdapter.java +11 −5 Original line number Diff line number Diff line Loading @@ -153,8 +153,11 @@ public class GroupBrowseListAdapter extends BaseAdapter { if (currentGroupId == mGroupId) { final ImageView[] children = getIconViewsSordedByFillOrder(icons); for (int i = 0; i < children.length; i++) { final long photoId = i < photoIds.size() ? photoIds.get(i) : 0; mContactPhotoManager.loadPhoto(children[i], photoId); if (i < photoIds.size()) { mContactPhotoManager.loadPhoto(children[i], photoIds.get(i)); } else { mContactPhotoManager.removePhoto(children[i]); } } } } Loading Loading @@ -318,13 +321,16 @@ public class GroupBrowseListAdapter extends BaseAdapter { if (photoIds != null) { // Cache is available. Let the photo manager load those IDs. for (int i = 0; i < children.length; i++) { final long photoId = i < photoIds.size() ? photoIds.get(i) : 0; mContactPhotoManager.loadPhoto(children[i], photoId); if (i < photoIds.size()) { mContactPhotoManager.loadPhoto(children[i], photoIds.get(i)); } else { mContactPhotoManager.removePhoto(children[i]); } } } else { // Cache is not available. Load photo IDs asynchronously. for (ImageView child : children) { mContactPhotoManager.loadPhoto(child, 0); mContactPhotoManager.removePhoto(child); } new AsyncPhotoIdLoadTask().execute( new AsyncPhotoIdLoadArg(icons, entry.getGroupId(), Loading
tests/src/com/android/contacts/tests/mocks/MockContactPhotoManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,11 @@ public class MockContactPhotoManager extends ContactPhotoManager { view.setImageResource(mDefaultResourceId); } @Override public void removePhoto(ImageView view) { view.setImageDrawable(null); } @Override public void pause() { } Loading