mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 19:42:17 +02:00
cleanup
This commit is contained in:
parent
621c259a68
commit
d9b061117a
3 changed files with 10 additions and 4 deletions
|
@ -72,7 +72,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;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,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);
|
||||||
|
@ -710,7 +712,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
|
||||||
myRemoveFromFavoritesStatement.execute();
|
myRemoveFromFavoritesStatement.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<Long> loadFavoritesIds() {
|
protected List<Long> loadFavoriteIds() {
|
||||||
final Cursor cursor = myDatabase.rawQuery(
|
final Cursor cursor = myDatabase.rawQuery(
|
||||||
"SELECT book_id FROM Favorites", null
|
"SELECT book_id FROM Favorites", null
|
||||||
);
|
);
|
||||||
|
@ -1241,4 +1243,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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public abstract class BooksDatabase {
|
||||||
protected abstract List<Long> loadRecentBookIds();
|
protected abstract List<Long> loadRecentBookIds();
|
||||||
protected abstract void saveRecentBookIds(final List<Long> ids);
|
protected abstract void saveRecentBookIds(final List<Long> ids);
|
||||||
|
|
||||||
protected abstract List<Long> loadFavoritesIds();
|
protected abstract List<Long> loadFavoriteIds();
|
||||||
protected abstract void addToFavorites(long bookId);
|
protected abstract void addToFavorites(long bookId);
|
||||||
protected abstract void removeFromFavorites(long bookId);
|
protected abstract void removeFromFavorites(long bookId);
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ public final class Library {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (long id : myDatabase.loadFavoritesIds()) {
|
for (long id : myDatabase.loadFavoriteIds()) {
|
||||||
Book book = savedBooksByBookId.get(id);
|
Book book = savedBooksByBookId.get(id);
|
||||||
if (book == null) {
|
if (book == null) {
|
||||||
book = Book.getById(id);
|
book = Book.getById(id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue