Commit 10a85320 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update Fresco version (fix breaking changes, add additional features and fresco's log settings).

parent 1a6b375c
...@@ -33,7 +33,7 @@ android { ...@@ -33,7 +33,7 @@ android {
} }
ext { ext {
frescoVersion = '1.3.0' frescoVersion = '1.4.0'
rxbindingVersion = '2.0.0' rxbindingVersion = '2.0.0'
} }
......
...@@ -2,24 +2,36 @@ package chat.rocket.android.widget; ...@@ -2,24 +2,36 @@ package chat.rocket.android.widget;
import android.content.Context; import android.content.Context;
import chat.rocket.android.widget.fresco.CustomImageFormatConfigurator; import chat.rocket.android.widget.fresco.CustomImageFormatConfigurator;
import com.facebook.common.logging.FLog;
import com.facebook.drawee.backends.pipeline.DraweeConfig; import com.facebook.drawee.backends.pipeline.DraweeConfig;
import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory; import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory;
import com.facebook.imagepipeline.core.ImagePipelineConfig; import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.listener.RequestListener;
import com.facebook.imagepipeline.listener.RequestLoggingListener;
import java.util.HashSet;
import java.util.Set;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
public class RocketChatWidgets { public class RocketChatWidgets {
public static void initialize(Context context, OkHttpClient okHttpClient) { public static void initialize(Context context, OkHttpClient okHttpClient) {
ImagePipelineConfig config = OkHttpImagePipelineConfigFactory FLog.setMinimumLoggingLevel(FLog.VERBOSE);
Set<RequestListener> listeners = new HashSet<>();
listeners.add(new RequestLoggingListener());
ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory
.newBuilder(context, okHttpClient) .newBuilder(context, okHttpClient)
.setDownsampleEnabled(true) .setRequestListeners(listeners)
.setImageDecoderConfig(CustomImageFormatConfigurator.createImageDecoderConfig()) .setImageDecoderConfig(CustomImageFormatConfigurator.createImageDecoderConfig())
.setDownsampleEnabled(true)
.experiment().setBitmapPrepareToDraw(true)
.experiment().setPartialImageCachingEnabled(true)
.build(); .build();
DraweeConfig.Builder draweeConfigBuilder = DraweeConfig.newBuilder(); DraweeConfig.Builder draweeConfigBuilder = DraweeConfig.newBuilder();
CustomImageFormatConfigurator.addCustomDrawableFactories(draweeConfigBuilder); CustomImageFormatConfigurator.addCustomDrawableFactories(draweeConfigBuilder);
Fresco.initialize(context, config, draweeConfigBuilder.build()); Fresco.initialize(context, imagePipelineConfig, draweeConfigBuilder.build());
} }
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ import android.graphics.drawable.Drawable; ...@@ -5,7 +5,7 @@ import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt; import android.support.annotation.ColorInt;
import android.support.v4.graphics.ColorUtils; import android.support.v4.graphics.ColorUtils;
import com.facebook.common.internal.ByteStreams; import com.facebook.common.internal.ByteStreams;
import com.facebook.drawee.backends.pipeline.DrawableFactory; import com.facebook.imagepipeline.drawable.DrawableFactory;
import com.facebook.imageformat.ImageFormat; import com.facebook.imageformat.ImageFormat;
import com.facebook.imageformat.ImageFormatCheckerUtils; import com.facebook.imageformat.ImageFormatCheckerUtils;
import com.facebook.imagepipeline.common.ImageDecodeOptions; import com.facebook.imagepipeline.common.ImageDecodeOptions;
......
...@@ -5,7 +5,7 @@ import android.graphics.drawable.Drawable; ...@@ -5,7 +5,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.PictureDrawable; import android.graphics.drawable.PictureDrawable;
import com.caverock.androidsvg.SVG; import com.caverock.androidsvg.SVG;
import com.caverock.androidsvg.SVGParseException; import com.caverock.androidsvg.SVGParseException;
import com.facebook.drawee.backends.pipeline.DrawableFactory; import com.facebook.imagepipeline.drawable.DrawableFactory;
import com.facebook.imageformat.ImageFormat; import com.facebook.imageformat.ImageFormat;
import com.facebook.imageformat.ImageFormatCheckerUtils; import com.facebook.imageformat.ImageFormatCheckerUtils;
import com.facebook.imagepipeline.common.ImageDecodeOptions; import com.facebook.imagepipeline.common.ImageDecodeOptions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment