Commit 4f3302bf authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update RocketChatWidgets.java

parent 5efbd8ed
...@@ -3,7 +3,6 @@ package chat.rocket.android.widget; ...@@ -3,7 +3,6 @@ package chat.rocket.android.widget;
import android.content.Context; import android.content.Context;
import com.facebook.common.logging.FLog; import com.facebook.common.logging.FLog;
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;
...@@ -13,16 +12,10 @@ import com.facebook.imagepipeline.listener.RequestLoggingListener; ...@@ -13,16 +12,10 @@ import com.facebook.imagepipeline.listener.RequestLoggingListener;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import chat.rocket.android.widget.fresco.CustomImageFormatConfigurator;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
public class RocketChatWidgets { public class RocketChatWidgets {
/**
* TODO
* The SVG support (by setImageDecoderConfig method) should be enabled after RC servers are stable.
* Info about that: https://github.com/RocketChat/Rocket.Chat/pull/7572
*/
public static void initialize(Context context, OkHttpClient okHttpClient) { public static void initialize(Context context, OkHttpClient okHttpClient) {
FLog.setMinimumLoggingLevel(FLog.VERBOSE); FLog.setMinimumLoggingLevel(FLog.VERBOSE);
Set<RequestListener> listeners = new HashSet<>(); Set<RequestListener> listeners = new HashSet<>();
...@@ -31,15 +24,11 @@ public class RocketChatWidgets { ...@@ -31,15 +24,11 @@ public class RocketChatWidgets {
ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory ImagePipelineConfig imagePipelineConfig = OkHttpImagePipelineConfigFactory
.newBuilder(context, okHttpClient) .newBuilder(context, okHttpClient)
.setRequestListeners(listeners) .setRequestListeners(listeners)
// .setImageDecoderConfig(CustomImageFormatConfigurator.createImageDecoderConfig())
.setDownsampleEnabled(true) .setDownsampleEnabled(true)
.experiment().setBitmapPrepareToDraw(true) .experiment().setBitmapPrepareToDraw(true)
.experiment().setPartialImageCachingEnabled(true) .experiment().setPartialImageCachingEnabled(true)
.build(); .build();
DraweeConfig.Builder draweeConfigBuilder = DraweeConfig.newBuilder(); Fresco.initialize(context, imagePipelineConfig);
CustomImageFormatConfigurator.addCustomDrawableFactories(draweeConfigBuilder);
Fresco.initialize(context, imagePipelineConfig, draweeConfigBuilder.build());
} }
} }
\ No newline at end of file
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