mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 15:39:16 +01:00
Fix an issue where the next chapter was the same as the current. Fix a NPE when page list throws
This commit is contained in:
parent
30b907bdf2
commit
5dcaeffa0b
@ -188,6 +188,10 @@ public class DatabaseHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PreparedGetListOfObjects<Chapter> getNextChapter(Chapter chapter) {
|
public PreparedGetListOfObjects<Chapter> getNextChapter(Chapter chapter) {
|
||||||
|
// Add a delta to the chapter number, because binary decimal representation
|
||||||
|
// can retrieve the same chapter again
|
||||||
|
double chapterNumber = chapter.chapter_number + 0.00001;
|
||||||
|
|
||||||
return db.get()
|
return db.get()
|
||||||
.listOfObjects(Chapter.class)
|
.listOfObjects(Chapter.class)
|
||||||
.withQuery(Query.builder()
|
.withQuery(Query.builder()
|
||||||
@ -195,7 +199,7 @@ public class DatabaseHelper {
|
|||||||
.where(ChapterTable.COLUMN_MANGA_ID + "=? AND " +
|
.where(ChapterTable.COLUMN_MANGA_ID + "=? AND " +
|
||||||
ChapterTable.COLUMN_CHAPTER_NUMBER + ">? AND " +
|
ChapterTable.COLUMN_CHAPTER_NUMBER + ">? AND " +
|
||||||
ChapterTable.COLUMN_CHAPTER_NUMBER + "<=?")
|
ChapterTable.COLUMN_CHAPTER_NUMBER + "<=?")
|
||||||
.whereArgs(chapter.manga_id, chapter.chapter_number, chapter.chapter_number + 1)
|
.whereArgs(chapter.manga_id, chapterNumber, chapterNumber + 1)
|
||||||
.orderBy(ChapterTable.COLUMN_CHAPTER_NUMBER)
|
.orderBy(ChapterTable.COLUMN_CHAPTER_NUMBER)
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.build())
|
.build())
|
||||||
@ -203,6 +207,10 @@ public class DatabaseHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PreparedGetListOfObjects<Chapter> getPreviousChapter(Chapter chapter) {
|
public PreparedGetListOfObjects<Chapter> getPreviousChapter(Chapter chapter) {
|
||||||
|
// Add a delta to the chapter number, because binary decimal representation
|
||||||
|
// can retrieve the same chapter again
|
||||||
|
double chapterNumber = chapter.chapter_number - 0.00001;
|
||||||
|
|
||||||
return db.get()
|
return db.get()
|
||||||
.listOfObjects(Chapter.class)
|
.listOfObjects(Chapter.class)
|
||||||
.withQuery(Query.builder()
|
.withQuery(Query.builder()
|
||||||
@ -210,7 +218,7 @@ public class DatabaseHelper {
|
|||||||
.where(ChapterTable.COLUMN_MANGA_ID + "=? AND " +
|
.where(ChapterTable.COLUMN_MANGA_ID + "=? AND " +
|
||||||
ChapterTable.COLUMN_CHAPTER_NUMBER + "<? AND " +
|
ChapterTable.COLUMN_CHAPTER_NUMBER + "<? AND " +
|
||||||
ChapterTable.COLUMN_CHAPTER_NUMBER + ">=?")
|
ChapterTable.COLUMN_CHAPTER_NUMBER + ">=?")
|
||||||
.whereArgs(chapter.manga_id, chapter.chapter_number, chapter.chapter_number - 1)
|
.whereArgs(chapter.manga_id, chapterNumber, chapterNumber - 1)
|
||||||
.orderBy(ChapterTable.COLUMN_CHAPTER_NUMBER + " DESC")
|
.orderBy(ChapterTable.COLUMN_CHAPTER_NUMBER + " DESC")
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.build())
|
.build())
|
||||||
|
@ -85,6 +85,7 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
|
|||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
readerMenu.destroy();
|
readerMenu.destroy();
|
||||||
|
if (viewer != null)
|
||||||
viewer.destroy();
|
viewer.destroy();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
@ -97,6 +98,7 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
|
if (viewer != null)
|
||||||
getPresenter().setCurrentPage(viewer.getCurrentPosition());
|
getPresenter().setCurrentPage(viewer.getCurrentPosition());
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user