ankidroid / Anki-Android

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

[Bug] Auto-rotate screen changes current reviewing card #9360

Closed Feripe-a closed 3 years ago

Feripe-a commented 3 years ago
Reproduction Steps
  1. Turn on "Auto-rotate";
  2. Start reviewing cards;
  3. Rotate the phone;
  4. Screen is rotated.
Expected Result

Anki would rotate the screen displaying the card in landscape or portrait mode.

Actual Result

As shown in this video, Anki does display the card in landscape or portrait mode but changes the current reviewing card to a different one.

Debug info

Refer to the support page if you are unsure where to get the "debug info". AnkiDroid Version = 2.16alpha7

Android Version = 11 (with LineageOS instead of MIUI. I think it has something to do with LineageOS.)

Manufacturer = Xiaomi

Model = Redmi Note 5

Hardware = qcom

Webview User Agent = Mozilla/5.0 (Linux; Android 11; Redmi Note 5 Build/RQ3A.210705.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.164 Mobile Safari/537.36

ACRA UUID = fc79c16d-49ff-4214-a96c-049159ef42a8

Scheduler = std2

Crash Reports Enabled = true

DatabaseV2 Enabled = true

Research

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

welcome[bot] commented 3 years ago

Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

prateek-singh-3212 commented 3 years ago

Hello @Feripe-a , Thanks for reporting the issue but I am unable to reproduce this on my device (Galaxy M51) and the vedio streaming link is not working.

Feripe-a commented 3 years ago

the video streaming link is not working.

Strange. It works just fine here. I've managed to reduce the quality to send the video here.

https://user-images.githubusercontent.com/84395172/127936443-4d406aa1-568d-4e71-ae0e-629034731019.mp4

Feripe-a commented 3 years ago

I am unable to reproduce this on my device (Galaxy M51).

That's why I wrote "Android Version = 11 (with LineageOS instead of MIUI)" because its related to LineageOS, but I don't know anyone that uses it and uses Anki -- I'm really sorry, I should've mentioned it.

prateek-singh-3212 commented 3 years ago

 I should've mentioned it.

No not an issue.

 I don't know anyone that uses it and uses Anki

Yes I also strongly believes on your thoughts. But i dont have stats so I can't confirm it.

This issue is related to OS itself. As far as I know ( please confirm that other app are working fine ?). If that's not the case then this issue will be on Priority -Low list.

Feripe-a commented 3 years ago

please confirm that other app are working fine?

Only Anki presents that kind of error. I've tasted with all apps I use every day, all of them rotate like they were supposed to.

mikehardy commented 3 years ago

I wonder - when you rotate the screen it usually restarts the activity as it represents a configuration change - perhaps there is some part of the bundle that is not saved restored correctly across activity restarts?

@prateek-singh-3212 if you try to reproduce after turning on developer mode in your system settings then toggling "keep activities" to off in the developer settings, you might see this.

It's a classic problem in Android apps (though most handle it now) and for us historically we have not always done a good job with it. Turning off keep activities is how to troubleshoot it then the fix is usually in saveInstanceBundle / onCreate to save/restore the proper variables across screen restart

I used to use LineageOS a lot actually :-), the thing about LineageOS is that it is very very close to stock Android, so this should not be LineageOS specific really, it should be reproducible if we just figure out how.

david-allison commented 3 years ago

Should be able to repro by toggling night mode

mikehardy commented 3 years ago

oh yes - that's another good repro style - for completeness, the reason why night mode would do it as well is because it also restarts the Activity - they both will perhaps trigger the same underlying (bad) code pathway

Feripe-a commented 3 years ago

I'm glad to read that you three are working looking at it. Keep up with the great work.

prateek-singh-3212 commented 3 years ago

if you try to reproduce after turning on developer mode in your system settings then toggling "keep activities" to off in the developer settings, you might see this.

Should be able to repro by toggling night mode

Yes, It is reproducable from both methods. Thanks for describing I am not aware about this. I will try to get back on this in future. (Taken Lot's of ISSUES in my Todo 😅 )

Feel free take this if anyone wants to.

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

Duplicate of #4035. I'll be working on this after a PR of mine goes in.