Skip to content

Commit

Permalink
Returned missed contacts photo considering
Browse files Browse the repository at this point in the history
  • Loading branch information
nostra13 committed Jul 17, 2014
1 parent 5636305 commit e5b004f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ContentLengthInputStream;
Expand Down Expand Up @@ -173,7 +174,7 @@ protected InputStream getStreamFromContent(String imageUri, Object extra) throws
ContentResolver res = context.getContentResolver();

Uri uri = Uri.parse(imageUri);
if (isVideoUri(uri)) {
if (isVideoUri(uri)) { // video thumbnail
Long origId = Long.valueOf(uri.getLastPathSegment());
Bitmap bitmap = MediaStore.Video.Thumbnails
.getThumbnail(res, origId, MediaStore.Images.Thumbnails.MINI_KIND, null);
Expand All @@ -182,6 +183,8 @@ protected InputStream getStreamFromContent(String imageUri, Object extra) throws
bitmap.compress(CompressFormat.PNG, 0, bos);
return new ByteArrayInputStream(bos.toByteArray());
}
} else if (imageUri.startsWith(CONTENT_CONTACTS_URI_PREFIX)) { // contacts photo
return ContactsContract.Contacts.openContactPhotoInputStream(res, uri);
}

return res.openInputStream(uri);
Expand Down

0 comments on commit e5b004f

Please sign in to comment.