Steps to reproduce the behaviour
- Create two books.
- With
Book 1 active, create a widget looking at any account in Book 1
- Open
Book 2 (making it active), then restart your device
- Observe that the widget created in step 2 no longer displays the selected account
Expected behaviour
The widget continues to display the account it was created with.
Actual behaviour
The widget displays "Account name" and one button which does nothing (there are two buttons if this is done on the develop branch). Clicking on the widget also does nothing.
If you re-open Book 1 and restart your device the widget will return to displaying the correct account.
My Thoughts
I've taken a look at the code, and the configuration saving/restoring needs to be rewritten. It's currently stored in the SharedPreferences for the account's book, but then if/when the widget is updated it tries to read the active book's SharedPreferences. We can solve this by either
- having one big "widget"
SharedPreferences object, and storing the book as another option for each widget, or
- we can have a separate
SharedPreferences object for each widget
I have a slight preference for the second option, but the first is more similar to the current implementation.
Steps to reproduce the behaviour
Book 1active, create a widget looking at any account inBook 1Book 2(making it active), then restart your deviceExpected behaviour
The widget continues to display the account it was created with.
Actual behaviour
The widget displays "Account name" and one button which does nothing (there are two buttons if this is done on the
developbranch). Clicking on the widget also does nothing.If you re-open
Book 1and restart your device the widget will return to displaying the correct account.My Thoughts
I've taken a look at the code, and the configuration saving/restoring needs to be rewritten. It's currently stored in the
SharedPreferencesfor the account's book, but then if/when the widget is updated it tries to read the active book'sSharedPreferences. We can solve this by eitherSharedPreferencesobject, and storing the book as another option for each widget, orSharedPreferencesobject for each widgetI have a slight preference for the second option, but the first is more similar to the current implementation.