android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

itemMediaView image flicker when loading image

Open FikriMilano opened this issue 1 year ago • 3 comments

Describe the bug itemMediaView image flicker when loading image.

Component SDC library

To Reproduce Steps to reproduce the behavior:

  1. Have a questionnaire that loads image using itemMedia
  2. Open it

Expected behavior Should not flicker.

Video

blinking_imageview.webm

Smartphone (please complete the following information):

  • Device: [e.g. Pixel4a emulator]
  • Android version: [e.g. Settings -> About phone -> Android version]
  • Build number: [e.g. Settings -> About phone -> Build number]
  • Version [e.g. 22]

Additional context N/A

Would you like to work on the issue? Yes

FikriMilano avatar Jul 29 '24 00:07 FikriMilano

I think the easiest way is to revert back to:

imageAttachment.setImageBitmap(image)

I've tried to fix Glide itself by following these tickets below, but none works: https://github.com/bumptech/glide/issues/755 https://github.com/bumptech/glide/issues/527

FikriMilano avatar Jul 29 '24 00:07 FikriMilano

I suspect it could be because of the reason in this comment which says

The flickering is caused by you loading images into the same view in quick succession.

Maybe the bind function is being called unnecessarily in quick succession? Not sure if that is solvable but can you investigate ? Thanks @FikriMilano

MJ1998 avatar Jul 29 '24 17:07 MJ1998

I think the easiest way is to revert back to:

imageAttachment.setImageBitmap(image)

I've tried to fix Glide itself by following these tickets below, but none works: bumptech/glide#755 bumptech/glide#527

why did we use glide in the first place?

i think what's happening is reflow caused by glide loading up the image after thee text is loaded.

a potential fix (i'm not saying it's better) to consider is reserving the space on screen so that the text doesn't get moved down - this would probably alleviate the blinking effect.

if we remove the use of glide here, should we remove it as a dependency? do we use it elsewhere?

jingtang10 avatar Aug 05 '24 13:08 jingtang10