1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

access rights + some bookmark-related methods moved to BookCollection

This commit is contained in:
Nikolay Pultsin 2013-02-10 00:00:35 +04:00
parent d8bb1ad585
commit 99b44927b3
5 changed files with 39 additions and 49 deletions

View file

@ -294,7 +294,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
private SQLiteStatement myUpdateBookInfoStatement;
@Override
public /*protected*/ void updateBookInfo(long bookId, long fileId, String encoding, String language, String title) {
protected void updateBookInfo(long bookId, long fileId, String encoding, String language, String title) {
if (myUpdateBookInfoStatement == null) {
myUpdateBookInfoStatement = myDatabase.compileStatement(
"UPDATE OR IGNORE Books SET file_id = ?, encoding = ?, language = ?, title = ? WHERE book_id = ?"
@ -310,7 +310,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
private SQLiteStatement myInsertBookInfoStatement;
@Override
public /*protected*/ long insertBookInfo(ZLFile file, String encoding, String language, String title) {
protected long insertBookInfo(ZLFile file, String encoding, String language, String title) {
if (myInsertBookInfoStatement == null) {
myInsertBookInfoStatement = myDatabase.compileStatement(
"INSERT OR IGNORE INTO Books (encoding,language,title,file_id) VALUES (?,?,?,?)"
@ -540,7 +540,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
private SQLiteStatement myRemoveFileInfoStatement;
public /*protected*/ void removeFileInfo(long fileId) {
protected void removeFileInfo(long fileId) {
if (fileId == -1) {
return;
}
@ -555,7 +555,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
private SQLiteStatement myInsertFileInfoStatement;
private SQLiteStatement myUpdateFileInfoStatement;
public /*protected*/ void saveFileInfo(FileInfo fileInfo) {
protected void saveFileInfo(FileInfo fileInfo) {
final long id = fileInfo.Id;
SQLiteStatement statement;
if (id == -1) {
@ -594,7 +594,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
}
public /*protected*/ Collection<FileInfo> loadFileInfos() {
protected Collection<FileInfo> loadFileInfos() {
Cursor cursor = myDatabase.rawQuery(
"SELECT file_id,name,parent_id,size FROM Files", null
);
@ -614,7 +614,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
return infosById.values();
}
public /*protected*/ Collection<FileInfo> loadFileInfos(ZLFile file) {
protected Collection<FileInfo> loadFileInfos(ZLFile file) {
final LinkedList<ZLFile> fileStack = new LinkedList<ZLFile>();
for (; file != null; file = file.getParent()) {
fileStack.addFirst(file);
@ -647,7 +647,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
return infos;
}
public /*protected*/ Collection<FileInfo> loadFileInfos(long fileId) {
protected Collection<FileInfo> loadFileInfos(long fileId) {
final ArrayList<FileInfo> infos = new ArrayList<FileInfo>();
while (fileId != -1) {
final Cursor cursor = myDatabase.rawQuery(
@ -675,7 +675,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
private SQLiteStatement mySaveRecentBookStatement;
public /*protected*/ void saveRecentBookIds(final List<Long> ids) {
protected void saveRecentBookIds(final List<Long> ids) {
if (mySaveRecentBookStatement == null) {
mySaveRecentBookStatement = myDatabase.compileStatement(
"INSERT OR IGNORE INTO RecentBooks (book_id) VALUES (?)"
@ -692,7 +692,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
});
}
public /*protected*/ List<Long> loadRecentBookIds() {
protected List<Long> loadRecentBookIds() {
final Cursor cursor = myDatabase.rawQuery(
"SELECT book_id FROM RecentBooks ORDER BY book_index", null
);
@ -758,7 +758,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
@Override
public /*protected*/ List<Bookmark> loadBookmarks(long bookId, boolean visible) {
protected List<Bookmark> loadBookmarks(long bookId, boolean visible) {
LinkedList<Bookmark> list = new LinkedList<Bookmark>();
Cursor cursor = myDatabase.rawQuery(
"SELECT Bookmarks.bookmark_id,Bookmarks.book_id,Books.title,Bookmarks.bookmark_text,Bookmarks.creation_time,Bookmarks.modification_time,Bookmarks.access_time,Bookmarks.access_counter,Bookmarks.model_id,Bookmarks.paragraph,Bookmarks.word,Bookmarks.char FROM Bookmarks INNER JOIN Books ON Books.book_id = Bookmarks.book_id WHERE Bookmarks.book_id = ? AND Bookmarks.visible = ?", new String[] { "" + bookId, visible ? "1" : "0" }
@ -785,7 +785,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
@Override
public /*protected*/ List<Bookmark> loadAllVisibleBookmarks() {
protected List<Bookmark> loadAllVisibleBookmarks() {
LinkedList<Bookmark> list = new LinkedList<Bookmark>();
myDatabase.execSQL("DELETE FROM Bookmarks WHERE book_id = -1");
Cursor cursor = myDatabase.rawQuery(
@ -815,7 +815,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
private SQLiteStatement myInsertBookmarkStatement;
private SQLiteStatement myUpdateBookmarkStatement;
@Override
public /*protected*/ long saveBookmark(Bookmark bookmark) {
protected long saveBookmark(Bookmark bookmark) {
SQLiteStatement statement;
if (bookmark.getId() == -1) {
if (myInsertBookmarkStatement == null) {
@ -857,7 +857,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
private SQLiteStatement myDeleteBookmarkStatement;
@Override
public /*protected*/ void deleteBookmark(Bookmark bookmark) {
protected void deleteBookmark(Bookmark bookmark) {
if (myDeleteBookmarkStatement == null) {
myDeleteBookmarkStatement = myDatabase.compileStatement(
"DELETE FROM Bookmarks WHERE bookmark_id = ?"
@ -867,7 +867,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
myDeleteBookmarkStatement.execute();
}
public /*protected*/ ZLTextPosition getStoredPosition(long bookId) {
protected ZLTextPosition getStoredPosition(long bookId) {
ZLTextPosition position = null;
Cursor cursor = myDatabase.rawQuery(
"SELECT paragraph,word,char FROM BookState WHERE book_id = " + bookId, null
@ -884,7 +884,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
private SQLiteStatement myStorePositionStatement;
public /*protected*/ void storePosition(long bookId, ZLTextPosition position) {
protected void storePosition(long bookId, ZLTextPosition position) {
if (myStorePositionStatement == null) {
myStorePositionStatement = myDatabase.compileStatement(
"INSERT OR REPLACE INTO BookState (book_id,paragraph,word,char) VALUES (?,?,?,?)"
@ -910,7 +910,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
}
private SQLiteStatement myStoreVisitedHyperlinksStatement;
public /*protected*/ void addVisitedHyperlink(long bookId, String hyperlinkId) {
protected void addVisitedHyperlink(long bookId, String hyperlinkId) {
if (myStoreVisitedHyperlinksStatement == null) {
myStoreVisitedHyperlinksStatement = myDatabase.compileStatement(
"INSERT OR IGNORE INTO VisitedHyperlinks(book_id,hyperlink_id) VALUES (?,?)"
@ -922,7 +922,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
myStoreVisitedHyperlinksStatement.execute();
}
public /*protected*/ Collection<String> loadVisitedHyperlinks(long bookId) {
protected Collection<String> loadVisitedHyperlinks(long bookId) {
final TreeSet<String> links = new TreeSet<String>();
final Cursor cursor = myDatabase.rawQuery("SELECT hyperlink_id FROM VisitedHyperlinks WHERE book_id = ?", new String[] { "" + bookId });
while (cursor.moveToNext()) {