mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
more code around book progress
This commit is contained in:
parent
f3bde8ade9
commit
0c12d14922
3 changed files with 8 additions and 5 deletions
|
@ -1048,7 +1048,7 @@ final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
|
||||
private SQLiteStatement mySaveProgessStatement;
|
||||
@Override
|
||||
protected void saveProgress(long bookId, RationalNumber progress) {
|
||||
protected void saveBookProgress(long bookId, RationalNumber progress) {
|
||||
if (mySaveProgessStatement == null) {
|
||||
mySaveProgessStatement = myDatabase.compileStatement(
|
||||
"INSERT OR REPLACE INTO BookReadingProgress (book_id,numerator,denominator) VALUES (?,?,?)"
|
||||
|
@ -1061,7 +1061,7 @@ final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RationalNumber loadProgress(long bookId) {
|
||||
protected RationalNumber getProgress(long bookId) {
|
||||
final RationalNumber progress;
|
||||
final Cursor cursor = myDatabase.rawQuery(
|
||||
"SELECT numerator,denominator FROM BookReadingProgress WHERE book_id = " + bookId, null
|
||||
|
|
|
@ -150,6 +150,7 @@ public class Book extends TitledEntity {
|
|||
myLabels = database.listLabels(myId);
|
||||
mySeriesInfo = database.getSeriesInfo(myId);
|
||||
myUids = database.listUids(myId);
|
||||
myProgress = database.getProgress(myId);
|
||||
HasBookmark = database.hasVisibleBookmark(myId);
|
||||
myIsSaved = true;
|
||||
if (myUids == null || myUids.isEmpty()) {
|
||||
|
@ -472,6 +473,9 @@ public class Book extends TitledEntity {
|
|||
for (UID uid : uids()) {
|
||||
database.saveBookUid(myId, uid);
|
||||
}
|
||||
if (myProgress != null) {
|
||||
database.saveBookProgress(myId, myProgress);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public abstract class BooksDatabase {
|
|||
protected abstract SeriesInfo getSeriesInfo(long bookId);
|
||||
protected abstract List<UID> listUids(long bookId);
|
||||
protected abstract boolean hasVisibleBookmark(long bookId);
|
||||
protected abstract RationalNumber getProgress(long bookId);
|
||||
|
||||
protected abstract Long bookIdByUid(UID uid);
|
||||
|
||||
|
@ -71,6 +72,7 @@ public abstract class BooksDatabase {
|
|||
protected abstract void saveBookSeriesInfo(long bookId, SeriesInfo seriesInfo);
|
||||
protected abstract void deleteAllBookUids(long bookId);
|
||||
protected abstract void saveBookUid(long bookId, UID uid);
|
||||
protected abstract void saveBookProgress(long bookId, RationalNumber progress);
|
||||
|
||||
protected FileInfo createFileInfo(long id, String name, FileInfo parent) {
|
||||
return new FileInfo(name, parent, id);
|
||||
|
@ -123,7 +125,4 @@ public abstract class BooksDatabase {
|
|||
|
||||
protected abstract Collection<String> loadVisitedHyperlinks(long bookId);
|
||||
protected abstract void addVisitedHyperlink(long bookId, String hyperlinkId);
|
||||
|
||||
protected abstract void saveProgress(long bookId, RationalNumber progress);
|
||||
protected abstract RationalNumber loadProgress(long bookId);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue