From 9fca6ba9e8ca13a9496f2d7b3de5647ce495e907 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 20 Sep 2017 23:56:19 +0200 Subject: [PATCH] Workaround for tdf#112483: Show slide content For some reason, the Bitmap set for the ImageView is always shown in white instead of showing the actual Bitmap. The Bitmap ("aBitmap") itself is OK, i.e. it holds the slide content. This sets the "real" bitmap as background image and sets another transparent dummy Bitmap in the foreground, which makes the slide content being shown. This is just a workaround and does not fix the (unknown) underlying problem... --- .../libreoffice/impressremote/util/ImageLoader.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/util/ImageLoader.java b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/util/ImageLoader.java index 1bd2f4f..e5ae9c7 100644 --- a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/util/ImageLoader.java +++ b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/util/ImageLoader.java @@ -14,6 +14,7 @@ import java.util.Arrays; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; @@ -128,7 +129,23 @@ public final class ImageLoader { return; } - getImageView().setImageBitmap(aBitmap); + /* + / WORKAROUND for bug tdf#112483 ("Impress Remote: Slide preview is blank"): + / The Bitmap set for the ImageView is for some reason always shown in white instead of + / the real slide content. + / Therefore, set a dummy Bitmap with the original Bitmap's dimensions and make it + / transparent. + / Set the real Bitmap as background image, since it is visible then behind the + / transparent dummy image. + / (NOTE: A deprecated method and constructor and method are used for this...) + / TODO: Fix the underlying problem and remove this workaround. + */ +// getImageView().setImageBitmap(aBitmap); + final Bitmap dummyTransparentImage = Bitmap.createBitmap(aBitmap.getWidth(), + aBitmap.getHeight(), Bitmap.Config.ARGB_8888); + dummyTransparentImage.eraseColor(Color.alpha(Color.TRANSPARENT)); + getImageView().setImageBitmap(dummyTransparentImage); + getImageView().setBackgroundDrawable(new BitmapDrawable(aBitmap)); } private ImageView getImageView() { -- 2.14.1