Giter Site home page Giter Site logo

Comments (9)

hssm avatar hssm commented on May 23, 2024
Fixing the bug regarding the problems to write on all the surface of the Whiteboard
when the orientation changes I have already fixed this bug too.

When Android detects a change in orientation, by default exectues onCreate again.
This behaviour it's not desirable because we only want to change the UI, not reopen
the deck and reload the cards. If onConfigurationChanged(Configuration newConfig is
overridden Android will execute this function instead of onCreate, when the
orientation changes, so it solves the problem.

Reported by edu.zasu on 2009-10-23 09:38:54

  • Status changed: Fixed

from anki-android.

hssm avatar hssm commented on May 23, 2024
Great :-)

Reported by nicolas.raoul on 2009-10-23 09:43:33

from anki-android.

hssm avatar hssm commented on May 23, 2024
I had a different solution in place here locally to fix this problem, but this one might
be better. I will try it 
out and see if it also fixes the problem with the crash on screen orientation change
while a deck is loading 
after it has been chosen in the deck picker.

Reported by daniel.svard on 2009-10-23 10:18:30

from anki-android.

hssm avatar hssm commented on May 23, 2024
I don't know if I completely understood how to provoke this crash you are talking
about but I tried it and I think it works just fine.

Let me know if something it is not working!

Reported by edu.zasu on 2009-10-23 10:33:06

from anki-android.

hssm avatar hssm commented on May 23, 2024
This is how I made it crash before:
1. Pick a new deck in the deck picker screen.
2. Rotate the screen while the "Loading deck. Please wait..." progress dialog is displaying.

It was a problem with the thread that is loading the deck trying to write to Ankidroid.currentCard,
but 
since the activity got restarted on the configuration change, that reference was not
valid any more. 
From reading the documentation on onConfigurationChanged, it seems that it prevents
the activity from 
being restarted and thus this problem would be solved too.

My solution involved using the onRetainNonConfigurationInstance() and getLastNonConfigurationInstance()
methods, as well as keeping a reference to the currently active 
activity and using a lock to limit the thread's access to it. 

Reported by daniel.svard on 2009-10-23 10:47:30

from anki-android.

hssm avatar hssm commented on May 23, 2024
I didn't manage to reproduce this :-/
I have the country-capitals deck and a ~15000 cards deck, maybe they load too fast?
Both take less than a second to load.
I am using my master branch.

Reported by nicolas.raoul on 2009-10-23 10:54:44

from anki-android.

hssm avatar hssm commented on May 23, 2024
Then you probably fixed it too. :-D Don't worry.
I just pulled Nicolas' master branch and I'll try it out. 

I think it was present at this commit at least: bec770b0e1b04831b538b044deb116451023a76d
(in Nicolas' 
branch)


Reported by daniel.svard on 2009-10-23 11:05:49

from anki-android.

hssm avatar hssm commented on May 23, 2024
Thanks, Daniel! We'll be waiting your feedback on that ;D

Reported by edu.zasu on 2009-10-23 11:11:59

from anki-android.

hssm avatar hssm commented on May 23, 2024
Tried it now and the bug doesn't seem to exist anymore. It also feels a lot more responsive
than my 
solution.
Great job Edu, thanks!

I'm thinking we should do something similar to the DeckPicker activity to not make
it reload all the deck 
data on an orientation change.

Reported by daniel.svard on 2009-10-23 11:21:52

from anki-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.