Skip to content

Commit 6d21c0f

Browse files
committed
Google Contacts Sync Service Content Supplement
1 parent 27bacdd commit 6d21c0f

File tree

11 files changed

+2268
-44
lines changed

11 files changed

+2268
-44
lines changed

play-services-base/src/main/java/com/google/android/gms/common/images/ImageManager.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ public byte[] compressBitmap(Bitmap original, int newWidth, int newHeight) {
9696
return byteArrayOutputStream.toByteArray();
9797
}
9898

99+
@WorkerThread
100+
public byte[] covertBitmap(final String url) {
101+
Bitmap cachedBitmap = getBitmapFromCache(url);
102+
if (cachedBitmap == null) {
103+
cachedBitmap = downloadBitmap(url);
104+
if (cachedBitmap == null) {
105+
return null;
106+
}
107+
addBitmapToCache(url, cachedBitmap);
108+
}
109+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
110+
cachedBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
111+
return outputStream.toByteArray();
112+
}
113+
99114
public void loadImage(final String url, final ImageView imageView) {
100115
if (imageView == null) {
101116
Log.d(TAG, "loadImage: imageView is null");

0 commit comments

Comments
 (0)