ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.81k stars 2.25k forks source link

Intermittent image flash in reviews? #7825

Closed adamwolf closed 3 years ago

adamwolf commented 4 years ago

Hi friends!

I got a new Pixel 4A, and noticed something. I do not know if this is actually related to the new phone, or if it's always been there, or if it's new.

I can definitely work on debugging it myself, but I'd appreciate any pointers and I'd like to run it past you all in case it's obvious.

Today, during my review, I noticed that some of my cards had a weird flash during the render. The flash was a larger version of the image on the card, offset, and it automatically rerendered really quickly.

After noticing it, I went back and tried the card again, and it was intermittent, happening maybe 20% of the time. It may be time-related or cache related or something...

The cards I noticed it on were all generated via an image occlusion plugin on desktop, but these are the only cards where I have large images.

Have we seen anything like this before? What's the next step for me? Turn on debug mode, hook up with Chromium on my machine, and see if I can reproduce it then?

Reproduction Steps
  1. Go through a review
Expected Result

Each time Q or A loads, the images load at the appropriate size.

Actual Result

Sometimes, there's an extremely quick flash of the image, larger, and offset, before rendering to the appropriate size.

Debug info

AnkiDroid Version = 2.14.1

Android Version = 11

ACRA UUID = a85fdb0c-2dec-4556-a3c0-b31daabe7604

Scheduler = std2

Research

Enter an [x] character to confirm the points below:

mikehardy commented 4 years ago

I would debug via webview debugging yeah, this sounds like a reflow from an image where initial image display size isn't computed or something so raw image dimensions are used then later the view is constrained causing the reflow. And racy apparently! should be fun ;-)

david-allison commented 4 years ago

Possibly the resizeImages call

https://github.com/ankidroid/Anki-Android/blob/f50a1d001a7adeb7df3724ee283ea5a82cf69abd/AnkiDroid/src/main/assets/scripts/card.js#L171-L182

adamwolf commented 4 years ago

I should look at the card and make sure there isn't any funny Javascript in it, too, I guess I didn't think about that!

On Fri, Dec 4, 2020 at 11:28 AM David Allison notifications@github.com wrote:

Possibly the resizeImages call

https://github.com/ankidroid/Anki-Android/blob/f50a1d001a7adeb7df3724ee283ea5a82cf69abd/AnkiDroid/src/main/assets/scripts/card.js#L171-L182

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/7825#issuecomment-738911823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIWYOBFPOGZGWP2PL4E3DSTEL5LANCNFSM4UNWWFEA .

mikehardy commented 4 years ago

Oh yeah! That was some code I think could be retired even. card.js has some dino-bits in it

github-actions[bot] commented 3 years ago

Hello šŸ‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

adamwolf commented 3 years ago

it's still there. i haven't yet been able to dig into it.

On Tue, Feb 2, 2021 at 1:07 PM github-actions[bot] notifications@github.com wrote:

Hello šŸ‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/7825#issuecomment-771898810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIWYPUY3X5UAEEE6RCKULS5BENVANCNFSM4UNWWFEA .

adamwolf commented 3 years ago

Hmm, I would have thought my comment would have made it not get closed?

mikehardy commented 3 years ago

That is strange, perhaps there was a race condition, and of course robots win those ;-) More seriously - reopening

github-actions[bot] commented 3 years ago

Hello šŸ‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

david-allison commented 3 years ago

@adamwolf Could you provide a deck export for a repro case?

GitGondola commented 3 years ago

I'm having the same issue. I recorded it, made it into a gif and slowed it down to highlight what happens. (see attached pic) In reality the image is the wrong size for 1 or 2 frames It still happens with all the javascript stripped from my card templates. 98842073

mikehardy commented 3 years ago

@GitGondola - are you able to build the app and load it on the phone to test changes? If so - if you removed that code from card.js above, I wonder if it would work correctly for you? Or perhaps it would be worse! But that's our hunch right now, to remove that code

github-actions[bot] commented 3 years ago

Hello šŸ‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically