calvinaquino / LNReader-Android

Light novel reader for android test project collab
Apache License 2.0
119 stars 36 forks source link

Novel Chapter List doesn't refresh anymore #177

Closed yaminorito closed 9 years ago

yaminorito commented 9 years ago

This function has been very helpful, even more so now on novels which have PREVIEW chapters.

Read chapters doesn't update until re-opening novel. Like this:

  1. Finish reading a chapter.
  2. Go back to Novel's chapters list.
  3. You'll see it's not checked yet as "Read".
  4. Have to either re-open novel or restart the app for it to update.

On a different note: Just a question on this part of NovelContentModel.java

public void refreshPageModel() throws Exception {
        if(this.pageModel == null) {
            NovelsDao dao = NovelsDao.getInstance();
            PageModel tempPage = new PageModel();
            tempPage.setPage(this.page);
            this.pageModel = dao.getPageModel(tempPage, null);
        }
    }

Shouldn't it be this way?

public void refreshPageModel() throws Exception {
        NovelsDao dao = NovelsDao.getInstance();
        PageModel tempPage = new PageModel();
        tempPage.setPage(this.page);
        this.pageModel = dao.getPageModel(tempPage, null);
    }

It's meant to refresh after all, so regardless of whether this.pageModel is null or not, it needs to be refreshed, or so I would like to think(Please correct me if I'm wrong). There still is a very very rare occasion(happened once after I updated to v1.1.25-beta3) in which issue #175 happens, I can't pinpoint exactly when it does happen, but it is tolerable.

freedomofkeima commented 9 years ago

Regarding the side note, are you sure that it happened after you updated it to v 1.1.25-beta3?

Actually issue #175 comes from a problem in assignment on the NovelContentModel: https://github.com/calvinaquino/LNReader-Android/blob/master/app/src/main/java/com/erakk/lnreader/dao/NovelsDao.java#L997

If you read the code, it shows that there is no assignment to pageModel in the NovelContentModelHelper (which retrieves NovelContent from local database): https://github.com/calvinaquino/LNReader-Android/blob/master/app/src/main/java/com/erakk/lnreader/helper/db/NovelContentModelHelper.java#L53

The additional validation of this.pageModel == null is actually for the second case, where the content is retrieved from the internet. In this case, the application has already checked for the pageModel at: https://github.com/calvinaquino/LNReader-Android/blob/master/app/src/main/java/com/erakk/lnreader/helper/db/NovelContentModelHelper.java#L123

So I think it will be redundant to retrieve (refresh) the pageModel twice.

Since I'm not the one who wrote the entire code, feel free to correct me if I'm wrong. After the latest update, I haven't had any issue with #175 .

Anyway, this issue (#177) also exists in my device. But in my case, it can be solved by scrolling down/up, without re-open novel or restart the app.

yaminorito commented 9 years ago

177: Scroll up/down doesn't work for me. Not even expanding/collapsing Volume list work(It did on previous versions)

175: I see, I never got farther looking into the code, thanks for code references. Yes, I'm sure I had v1.1.25-beta3 that time it happened, but just once that's why I think it's as good as fixed or maybe I just had to refresh my novel contents to fix it, and I already did for the most of my dled novels.

Nandaka commented 9 years ago

hiya, sorry for the late update. I got Real Life(:tm:) works, so the updates might bit late :smiley:

yaminorito commented 9 years ago

Yep works now, though in my case I had to uninstall the app first on my JB(made sure I had custom image path and db backup ofc, then made a clean install). Thank you!