diff --git a/app/src/main/java/com/jasonette/seed/Core/JasonViewActivity.java b/app/src/main/java/com/jasonette/seed/Core/JasonViewActivity.java index 8029928e..845ba357 100644 --- a/app/src/main/java/com/jasonette/seed/Core/JasonViewActivity.java +++ b/app/src/main/java/com/jasonette/seed/Core/JasonViewActivity.java @@ -49,6 +49,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; +import com.bumptech.glide.request.target.ViewTarget; import com.eclipsesource.v8.debug.mirror.Frame; import com.jasonette.seed.Component.JasonComponentFactory; import com.jasonette.seed.Component.JasonImageComponent; @@ -1443,22 +1444,26 @@ public void run() { JSONObject c = new JSONObject(); c.put("url", background); if(background.matches("(file|http[s]?):\\/\\/.*")) { + ViewTarget target; if (background.matches(".*\\.gif")) { - with(JasonViewActivity.this).load(JasonImageComponent.resolve_url(c, JasonViewActivity.this)).asGif().into(new SimpleTarget() { + target = new ViewTarget(sectionLayout) { @Override public void onResourceReady(GifDrawable resource, GlideAnimation glideAnimation) { sectionLayout.setBackground(resource); - } - }); + }; } else { - with(JasonViewActivity.this).load(JasonImageComponent.resolve_url(c, JasonViewActivity.this)).into(new SimpleTarget() { + target = new ViewTarget(sectionLayout) { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation glideAnimation) { sectionLayout.setBackground(resource); } - }); + }; } + with(JasonViewActivity.this) + .load(JasonImageComponent.resolve_url(c, JasonViewActivity.this)) + .centerCrop() + .into(target); } else if(background == "camera") { } else if(background.matches("data:image.*")){ String base64 = background.substring("data:image/jpeg;base64,".length());