Closed timo-a closed 8 months ago
Is it right to allow the user the option of swiping the nav menu and toggling night mode while on preview view, as edit note view does not have this option?
The way we restart activities when toggling night mode doesn't really work for the previewer (hierarchy and state are both lost). So unless we come up with a better way to do that in the future, I think the quick and easy solution to avoiding the crash is indeed to disable the nav drawer.
As for point 2 in the original issue, that is not what usually happens, so I don't know what is going on with that.
@hssm: # 2: I see this from time to time. One way i think this can happen is when a learning card (card B) becomes due while you (re)view card A.
@hssm I found a new way to produce the behaviour in point 2! You don't need new or red-because-wrong-answer cards. open deck get first card correct on second card switch to night mode
Just wanted to mention I'm still getting the behavior in point # 2. Generally I leave night mode on, but one of my cards has a stroke order diagram with black lines on a transparent background, which is practically invisible in night mode. Therefore I pull out the navigation drawer, turn off night mode --- and then am presented with different cards. So I end up having night mode disabled for a significant part of the review session, until that offending card reappears in the reviews.
Not a big deal at the end of the day, but it does take a little bit to get back in rhythm of review.
Switching to or from night mode causes a full app restart if I recall, yes. So pretty much any ephemeral state (like, current state of the reviewer activity) will be blown away. Not sure how I'd handle that but if there was a way to stuff info in a bundle for the activity and reload it, and someone followed through the control chain on night-mode switches, might be possible.
@ukanuk this should be fixed I think along with #5688 via #5693 ? But maybe reviewer needs a change too? Can you check the latest alphas to see if you reproduce
@mikehardy The issue is still present when toggling night mode, although I can swap between portrait/landscape on both reviewer and previewer without losing the current card.
This is with version 2.10alpha43, which I got from following directions at https://docs.ankidroid.org/manual.html#betaTesting to join the Google Play beta and also the ankidroidalphatesters google group.
@ukanuk sorry it is still happening but thanks a lot for checking that out and letting us know
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
This is a special case of #3654 - please refer to that issue for easier reproduction than night mode toggles (specifically: "don't keep activities" developer setting in phone preferences
This is a more complex issue than initially appears.
The issue is that the card is not saved onSaveInstanceState
, to work around this, we refresh the next card from the scheduler onCollectionLoaded
:
In this time, the "next" card from the scheduler may have changed. This causes a different card to be displayed
As for solutions:
card
to the instance stateNot currently feasible. The scheduler makes modifications to the card object inside sched.getCard. This may be only AnkiDroid-related code
Not currently feasible. Arbitrary card retrieval not supported by the Rust scheduler: https://github.com/ankitects/anki/blob/main/proto/anki/scheduler.proto#L15
sched
backend (many different parameters saved, but the same concept)That should not be necessary in the v3 scheduler; getQueuedCards() is designed to be idempotent under most circumstances.
1) go to Browser select preview on a card pull side bar in, switch to night mode ->crash
2) review card A pull side bar in, switch to night mode -> another card B is on top, card A has disappeared back into the deck