Hello,
I have a problem with flickering/refreshing every time new card shows. It doesn't happen on the desktop version of Anki. I don't know really why. Could it be due to the card template? I'm attaching gifs to show what I'm talking about.
Ankidroid 2.9.80a
edit. Stable version 2.8.4 has no such problem.


Same here. It happend after the update to 2.9beta2.
Beta1 didn't have that problem.
Beta3 still has it.
Related question: if I want to downgrade to a previous version, do I need to uninstall AnkiDroid first? Will I lose all app settings like gestures and so on?
Edit: I don't think it's a matter of card templates since all my templates flicker when showing the answer, no matter if I use JS and large fonts or not.
@adamwolf
Could this be caused by #5382?
Maybe! I don't think that change was in beta2 though! Can we check? I do
suspect it is related to MathJax in general, if not that particular change.
Does it do this on Anki Desktop?
Fixing this so that it doesn't blip and doesn't visually rerender MathJax
may be a chunk of work.
I wonder if we could detect MathJax cards and only load the MathJax
renderer for those cards... It would be different than what Anki Desktop
does, but it might be a quicker intermediate fix for most cards.
Do we currently show the whole card with a hidden answer and then reveal
the answer, or do we reload the webview for the answer?
On Sat, Jul 20, 2019, 4:16 AM Tim Rae notifications@github.com wrote:
@adamwolf https://github.com/adamwolf
Could this be caused by #5382
https://github.com/ankidroid/Anki-Android/pull/5382?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ankidroid/Anki-Android/issues/5384?email_source=notifications&email_token=AAAIWYK62D5PXVNCITU5LR3QALJWHA5CNFSM4IEP2GAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2NKM3A#issuecomment-513451628,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAIWYOJND6EIACVOG3VMUDQALJWHANCNFSM4IEP2GAA
.
Yes, you can check the log here:
https://github.com/ankidroid/Anki-Android/commits/release-2.9
The latest mathjax patch was indeed introduced in beta2, and I can also reproduce the issue, so I will revert that for now. I don't notice any flicker in beta1, though the very first card does take much longer to load.
@mjuzikfrik Does it happen for you on simpler cards as well? If not, can you please attach a sample deck that reproduces the issue?
That change was beta2 - https://github.com/ankidroid/Anki-Android/commits/release-2.9
Well, my prediction of flicker-sensitive users was accurate at least, but it's not a celebration ;-)
We currently go back to Java on card interaction and for answers we then fetch the answer, generate new HTML and push that back into the existing WebView (whole page load, but re-used WebView) based on my last investigation
It does seem like a viable deviation from Desktop to check for MathJax on a card (should be easy? famous last words) and only pull in all that machinery if needed.
I can take a look at this this week. It may be good to see how Anki Desktop
does it. I think they get away with all of this by having a 200 ms fade,
but I am not 100% sure.
Would we want to do that?
I think detecting MathJax and only waiting for MathJax to render will be
less work than the initial MathJax work and is something I can likely
tackle by the end of this week.
The fade would be pretty easy too. I'm not sure I'm in love with either
one of these options, but I don't hate them either.
On Sat, Jul 20, 2019, 5:48 PM Mike Hardy notifications@github.com wrote:
That change was beta2 -
https://github.com/ankidroid/Anki-Android/commits/release-2.9Well, my prediction of flicker-sensitive users was accurate at least, but
it's not a celebration ;-)We currently go back to Java on card interaction and for answers we then
fetch the answer, generate new HTML and push that back into the existing
WebView (whole page load, but re-used WebView) based on my last
investigationIt does seem like a viable deviation from Desktop to check for MathJax on
a card (should be easy? famous last words) and only pull in all that
machinery if needed.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ankidroid/Anki-Android/issues/5384?email_source=notifications&email_token=AAAIWYL75I4AFEUCZ7A6XK3QAOI2JA5CNFSM4IEP2GAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2NXLNI#issuecomment-513504693,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAIWYOM5O56LENVUUBPAVLQAOI2JANCNFSM4IEP2GAA
.
@dae
Did you do anything particular on Anki mobile to prevent mathjax slowing down rendering?
I suspect the issues lie in the fact that AnkiDroid loads a new webpage on each card transition, instead of just dynamically updating part of it, so external fonts and Javascript have to be loaded each time.
Fonts and js should be cached by most webviews after the first card is loaded. Changing the way we populate the html would be too big of a change for 2.9, but I agree in the long term that would be a better solution.
I doesn't seem to happen to basic template. Maybe it's due to animations I have in my cards. I think that I had the problem in all betas. I can check it. Here's the deck.
https://drive.google.com/file/d/1v5vQC8QP7BbAGJyzvK25fz4HttNhuv8W/view?usp=sharing
If you can tell us the exact version where the problem was introduced, we can try to reproduce and see what would be involved to fix it. For example if it's caused by loading the Mathjax library then most likely the problem will not exist in 2.9alpha69, but it will exist in 2.9alpha 70. Can you please test it and let us know exactly which version the problem was introduced? See here for how to install specific versions, in case it's not obvious.
The flickering affects all of my decks and was introduced with Beta2. Depending on the template, this can be a very annoying bug and it reminds me of the credits in Python's Knights of the round table: https://youtu.be/SII-jhEd-a0 (3:10)
Anyway, it's fixed now with beta4, thank you!
I can install all the previous betas to check exactly which one introduced the flickering. But again: do I need to uninstall the current version first and will I lose the app settings?
@Anthropos888
My last message was not directed at you, it was for the OP. Your issue should be fixed in beta 4, but that will not be the case for the OP.
FYI, yes you do need to uninstall to go back to a previous version, and yes you will lose your app settings (but not your flashcard database) when you do that.
@timrae
It's exactly as you said. 2.9 alpha 69 is free of that flicker and it's introduced with alpha 70.
Thank you for confirming that.
@adamwolf
If we were to only include the mathjax CSS when mathjax is detected on a card, how would we detect the presence or absence of mathjax?
I think a dynamic load would be a javascript thing, so perhaps in AbstractFlashcardViewer.java - where we have knowledge of card contents via inspection if we want - we could emit some javascript variable that indicates presence of mathjax in the card question or answer, then in the card html the mathjax load could be keyed on that?
I don't think it would necessarily have to be a js thing, we could probably handle it in a similar way to night mode if that were advantageous for some reason (like simplicity). The question is how do we detect mathjax
it's a regex - and I think @adamwolf already has that part nailed with unit testing https://apps.ankiweb.net/docs/manual.html#mathjax-support - should be (famous last words, as ever) easy to apply in java and then emit whatever (CSS or javascript variable or ? )
Ok, yeah there are probably several different ways to do implement it, most likely one or more winners will emerge during testing ;)
I think the blink is happening in card.js, where we're render MathJax in
onload.
Let's add a class to the card in AbstractFlashcardViewer, and only render
in card.js if that class is detected. We can also be smart about adding
the mathjax-hasnt-rendeted-yet only to cards with MathJax, to prevent that
other blink on non MathJax cards.
I think it makes sense to revisit how the card/answers are loaded after 2.9
to fix this in a deeper way.
I apologize if some of my references are incorrect, I am writing this from
a mobile device.
On Sun, Jul 21, 2019, 7:13 AM Tim Rae notifications@github.com wrote:
Ok, yeah there are probably several different ways to do implement it,
most likely one or more winners will emerge during testing ;)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ankidroid/Anki-Android/issues/5384?email_source=notifications&email_token=AAAIWYNIANBT5VWSY3YHIKLQARHFDA5CNFSM4IEP2GAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OCAXQ#issuecomment-513548382,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAIWYMFOCG4UZQFPKD5CMDQARHFDANCNFSM4IEP2GAA
.
I have made progress on this. It looks pretty good but I need to test it more.
@mjuzikfrik
How is it in beta5?
Working fine! :) Thank you.
Great!
On Sat, Jul 27, 2019, 3:42 PM mjuzikfrik notifications@github.com wrote:
Working fine! :) Thank you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ankidroid/Anki-Android/issues/5384?email_source=notifications&email_token=AAAIWYOIHYMRDL3YOBVMGJDQBSXKZA5CNFSM4IEP2GAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26SJ3A#issuecomment-515712236,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAIWYOO7JKWY7HCNOQPUPDQBSXKZANCNFSM4IEP2GAA
.