codinguser / gnucash-android

Gnucash for Android mobile companion application.
Apache License 2.0
1.22k stars 538 forks source link

Fixes #586 : Remove content of AccountsActivity.AccountViewPagerAdapt… #875

Closed JeanGarf closed 4 years ago

JeanGarf commented 4 years ago

The problem appeared when switching to Recent or Favorites Account Tab and then opening another Book. The problem did not appear when switching to "All" tab, then opening another book, even having open Recent or Favorites tab before "All" tab.

The Exception was thrown in DatabaseAdapter.getID() by the line : throw new IllegalArgumentException(mTableName + " with GUID " + uid + " does not exist in the db"); because the uid has been built from cursor given in AccountRecyclerAdapter.AccountsListFragment.onBindViewHolderCursor(AccountViewHolder, Cursor), which is a cursor on the previous Book and this uid does not exists in the newly opened Book.

I fixed the issue in (7b6ebb398c89459ffe479d519ee5a69db2449ae9) by removing the content of AccountsActivity.AccountViewPagerAdapter.destroyItem().

I don't know why this fixed the problem, but I found it by discovering that destroyItem() was not called when switching to "All" Tab, but was when switching to Recent or Favorites Tab.

madushan1000 commented 4 years ago

@JeanGarf Can you make a build with your improvements? This project looks dead.

JeanGarf commented 4 years ago

After having done #876, I restore state as before #586 (in 1e2d83acbd8eb0c9b96d6b1e49dd326ee0a7befc) and it seems to be OK.

So I remove this pull request, but #586 is fixed by #876.

JeanGarf commented 4 years ago

@JeanGarf Can you make a build with your improvements? This project looks dead.

Yes I can.

Where can I do that ?

madushan1000 commented 4 years ago

You know what, I'll set up an f-droid repo for your version using github actions. I need a couple of other forked apps built anyway which nobody is managing automated builds for.

madushan1000 commented 4 years ago

I've set up a repo here (https://madushan1000.github.io/fdroid-repo/repo/), I can configure it to do automated builds for each commit to your repo if you can configure a webhook.

JeanGarf commented 4 years ago

Hi madushan1000,

Sorry, I didn't saw your post and therefore, I added a page on my web site to allow downloading of the apk with all my contributions (my 10 Pull Requests. See #882 ) http://thierryw777.free.fr/index.php/bureautique/comptabilite/gnucash-android/

If you're interested to test or use it, tell me if it works fine.

See you