// setBackgroundDrawable is deprecated from API 16+ (Jelly Bean), but we still want to target // earlier versions; // since this is purely a name change, there's no real reason to do anything platform-independent @SuppressWarnings("deprecation") private void updatePeopleIcons(boolean fadeIn) { mPendingIconsUpdate = false; final GridView grid = mGrid; final FastBitmapDrawable icon = mDefaultIcon; final int count = grid.getChildCount(); for (int i = 0; i < count; i++) { final View view = grid.getChildAt(i); final PersonViewHolder holder = (PersonViewHolder) view.getTag(); if (holder.queryIcon) { // if the icon has gone missing (recently imported or cache deletion), regenerate it String personCacheId = PersonItem.getCacheId(holder.personInternalId); FastBitmapDrawable cachedIcon = ImageCacheUtilities.getCachedIcon( MediaTablet.DIRECTORY_THUMBS, personCacheId, ImageCacheUtilities.NULL_DRAWABLE); if (ImageCacheUtilities.NULL_DRAWABLE.equals(cachedIcon)) { PersonManager.reloadPersonIcon( getResources(), getContentResolver(), holder.personInternalId); cachedIcon = ImageCacheUtilities.getCachedIcon(MediaTablet.DIRECTORY_THUMBS, personCacheId, icon); } if (fadeIn) { CrossFadeDrawable d = holder.transition; d.setEnd(cachedIcon.getBitmap()); holder.display.setBackgroundDrawable(d); d.startTransition(MediaTablet.ANIMATION_FADE_TRANSITION_DURATION); } else { holder.display.setBackgroundDrawable(cachedIcon); } holder.loader.setVisibility(View.GONE); holder.queryIcon = false; if (holder.selected) { holder.overlay.setBackgroundResource(R.drawable.item_public); holder.overlay.setPadding(0, 0, 0, 0); } else { holder.overlay.setBackgroundDrawable(null); } } } grid.invalidate(); }
@Override protected void onDestroy() { ImageCacheUtilities.cleanupCache(); super.onDestroy(); }