1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +02:00

removed unused methods

This commit is contained in:
Nikolay Pultsin 2013-01-13 07:55:41 +04:00
parent b21459cdd0
commit 8a78a11bd8
5 changed files with 7 additions and 51 deletions

View file

@ -71,7 +71,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
private void migrate(Context context) { private void migrate(Context context) {
final int version = myDatabase.getVersion(); final int version = myDatabase.getVersion();
final int currentVersion = 19; final int currentVersion = 20;
if (version >= currentVersion) { if (version >= currentVersion) {
return; return;
} }
@ -118,6 +118,8 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
updateTables17(); updateTables17();
case 18: case 18:
updateTables18(); updateTables18();
case 19:
updateTables19();
} }
myDatabase.setTransactionSuccessful(); myDatabase.setTransactionSuccessful();
myDatabase.setVersion(currentVersion); myDatabase.setVersion(currentVersion);
@ -861,42 +863,6 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
myStorePositionStatement.execute(); myStorePositionStatement.execute();
} }
private SQLiteStatement myInsertIntoBookListStatement;
protected boolean insertIntoBookList(long bookId) {
if (myInsertIntoBookListStatement == null) {
myInsertIntoBookListStatement = myDatabase.compileStatement(
"INSERT OR IGNORE INTO BookList(book_id) VALUES (?)"
);
}
myInsertIntoBookListStatement.bindLong(1, bookId);
myInsertIntoBookListStatement.execute();
return true;
}
private SQLiteStatement myDeleteFromBookListStatement;
protected boolean deleteFromBookList(long bookId) {
if (myDeleteFromBookListStatement == null) {
myDeleteFromBookListStatement = myDatabase.compileStatement(
"DELETE FROM BookList WHERE book_id = ?"
);
}
myDeleteFromBookListStatement.bindLong(1, bookId);
myDeleteFromBookListStatement.execute();
deleteVisitedHyperlinks(bookId);
return true;
}
private SQLiteStatement myCheckBookListStatement;
protected boolean checkBookList(long bookId) {
if (myCheckBookListStatement == null) {
myCheckBookListStatement = myDatabase.compileStatement(
"SELECT COUNT(*) FROM BookList WHERE book_id = ?"
);
}
myCheckBookListStatement.bindLong(1, bookId);
return myCheckBookListStatement.simpleQueryForLong() > 0;
}
private SQLiteStatement myDeleteVisitedHyperlinksStatement; private SQLiteStatement myDeleteVisitedHyperlinksStatement;
private void deleteVisitedHyperlinks(long bookId) { private void deleteVisitedHyperlinks(long bookId) {
if (myDeleteVisitedHyperlinksStatement == null) { if (myDeleteVisitedHyperlinksStatement == null) {
@ -1276,4 +1242,8 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
cursor.close(); cursor.close();
myDatabase.execSQL("DROP TABLE BookSeries_Obsolete"); myDatabase.execSQL("DROP TABLE BookSeries_Obsolete");
} }
private void updateTables19() {
myDatabase.execSQL("DROP TABLE BookList");
}
} }

View file

@ -407,12 +407,6 @@ public class Book {
} }
} }
public void insertIntoBookList() {
if (myId != -1) {
BooksDatabase.Instance().insertIntoBookList(myId);
}
}
public String getContentHashCode() { public String getContentHashCode() {
InputStream stream = null; InputStream stream = null;

View file

@ -179,7 +179,6 @@ public class BookCollection implements IBookCollection {
if (ids.remove(book.getId())) { if (ids.remove(book.getId())) {
myDatabase.saveRecentBookIds(ids); myDatabase.saveRecentBookIds(ids);
} }
myDatabase.deleteFromBookList(book.getId());
if (deleteFromDisk) { if (deleteFromDisk) {
book.File.getPhysicalFile().delete(); book.File.getPhysicalFile().delete();
} }
@ -311,7 +310,6 @@ public class BookCollection implements IBookCollection {
physicalFiles.add(file); physicalFiles.add(file);
} }
if (file != book.File && file != null && file.getPath().endsWith(".epub")) { if (file != book.File && file != null && file.getPath().endsWith(".epub")) {
myDatabase.deleteFromBookList(book.getId());
continue; continue;
} }
if (book.File.exists()) { if (book.File.exists()) {

View file

@ -102,10 +102,6 @@ public abstract class BooksDatabase {
protected abstract ZLTextPosition getStoredPosition(long bookId); protected abstract ZLTextPosition getStoredPosition(long bookId);
protected abstract void storePosition(long bookId, ZLTextPosition position); protected abstract void storePosition(long bookId, ZLTextPosition position);
protected abstract boolean insertIntoBookList(long bookId);
protected abstract boolean deleteFromBookList(long bookId);
protected abstract boolean checkBookList(long bookId);
protected abstract Collection<String> loadVisitedHyperlinks(long bookId); protected abstract Collection<String> loadVisitedHyperlinks(long bookId);
protected abstract void addVisitedHyperlink(long bookId, String hyperlinkId); protected abstract void addVisitedHyperlink(long bookId, String hyperlinkId);
} }

View file

@ -342,14 +342,12 @@ public final class FBReaderApp extends ZLApplication {
} }
Book book = Collection.getBookByFile(file); Book book = Collection.getBookByFile(file);
if (book != null) { if (book != null) {
book.insertIntoBookList();
return book; return book;
} }
if (file.isArchive()) { if (file.isArchive()) {
for (ZLFile child : file.children()) { for (ZLFile child : file.children()) {
book = Collection.getBookByFile(child); book = Collection.getBookByFile(child);
if (book != null) { if (book != null) {
book.insertIntoBookList();
return book; return book;
} }
} }