From 486f2e15714840f77a9712753e3798e7334a8097 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 25 Dec 2017 13:12:16 +0100 Subject: [PATCH] Improved performances of image downloading --- .../client/data/ImageLoad/ImageDownloadRunnable.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/ImageLoad/ImageDownloadRunnable.java b/app/src/main/java/org/communiquons/android/comunic/client/data/ImageLoad/ImageDownloadRunnable.java index 4227b86..7352447 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/ImageLoad/ImageDownloadRunnable.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/ImageLoad/ImageDownloadRunnable.java @@ -1,5 +1,8 @@ package org.communiquons.android.comunic.client.data.ImageLoad; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; + import org.communiquons.android.comunic.client.data.Utilities; import java.io.File; @@ -57,8 +60,9 @@ class ImageDownloadRunnable implements Runnable { //Get input stream InputStream is = conn.getInputStream(); - //Transfer bytes - Utilities.InputToOutputStream(is, os); + //Process image + Bitmap image =BitmapFactory.decodeStream(is); + image.compress(Bitmap.CompressFormat.PNG, 100, os); os.close(); is.close();