Clean up
This commit is contained in:
1 parent
e353bbe4c3
commit
5e6d24f01e
10 files changed
+14
-47
No files matched your search
@@ -602,9 +602,9 @@ public class EhDB {
|
||||
}
|
||||
|
||||
private static <T> boolean copyDao(BasicDao<T> from, BasicDao<T> to) {
|
||||
List<T> list = from.fakeList();
|
||||
List<T> list = from.list();
|
||||
for (T item : list)
|
||||
to.fakeInsert(item);
|
||||
to.insert(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ public class EhDB {
|
||||
manager.addDownloadLabel(downloadLabelList);
|
||||
|
||||
// Download dirname
|
||||
List<DownloadDirname> downloadDirnameList = oldRoomDatabase.downloadDirnameDao().fakeList();
|
||||
List<DownloadDirname> downloadDirnameList = oldRoomDatabase.downloadDirnameDao().list();
|
||||
for (DownloadDirname dirname : downloadDirnameList) {
|
||||
putDownloadDirname(dirname.getGid(), dirname.getDirname());
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ package com.hippo.ehviewer.dao;
|
||||
import java.util.List;
|
||||
|
||||
public interface BasicDao<T> {
|
||||
List<T> fakeList();
|
||||
void fakeInsert(T t);
|
||||
List<T> list();
|
||||
long insert(T t);
|
||||
}
|
||||
@@ -3,12 +3,18 @@ package com.hippo.ehviewer.dao;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface BookmarksDao {
|
||||
public interface BookmarksDao extends BasicDao<BookmarkInfo> {
|
||||
@Insert
|
||||
void insert(BookmarkInfo bookmark);
|
||||
long insert(BookmarkInfo bookmark);
|
||||
|
||||
@Delete
|
||||
void delete(BookmarkInfo bookmark);
|
||||
|
||||
@Query("SELECT * FROM BOOKMARKS ORDER BY TIME DESC")
|
||||
List<BookmarkInfo> list();
|
||||
}
|
||||
@@ -25,8 +25,5 @@ public interface DownloadDirnameDao extends BasicDao<DownloadDirname> {
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM DOWNLOAD_DIRNAME")
|
||||
List<DownloadDirname> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(DownloadDirname t);
|
||||
List<DownloadDirname> list();
|
||||
}
|
||||
@@ -27,10 +27,4 @@ public interface DownloadLabelDao extends BasicDao<DownloadLabel> {
|
||||
|
||||
@Delete
|
||||
void delete(DownloadLabel downloadLabel);
|
||||
|
||||
@Query("SELECT * FROM DOWNLOAD_LABELS ORDER BY TIME ASC")
|
||||
List<DownloadLabel> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(DownloadLabel t);
|
||||
}
|
||||
@@ -24,10 +24,4 @@ public interface DownloadsDao extends BasicDao<DownloadInfo> {
|
||||
|
||||
@Delete
|
||||
void delete(DownloadInfo downloadInfo);
|
||||
|
||||
@Query("SELECT * FROM DOWNLOADS ORDER BY TIME DESC")
|
||||
List<DownloadInfo> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(DownloadInfo t);
|
||||
}
|
||||
@@ -21,10 +21,4 @@ public interface FilterDao extends BasicDao<Filter> {
|
||||
|
||||
@Delete
|
||||
void delete(Filter filter);
|
||||
|
||||
@Query("SELECT * FROM FILTER")
|
||||
List<Filter> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(Filter t);
|
||||
}
|
||||
@@ -33,10 +33,4 @@ public interface HistoryDao extends BasicDao<HistoryInfo> {
|
||||
|
||||
@Query("DELETE FROM HISTORY")
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM HISTORY ORDER BY TIME DESC")
|
||||
List<HistoryInfo> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(HistoryInfo t);
|
||||
}
|
||||
@@ -26,10 +26,4 @@ public interface LocalFavoritesDao extends BasicDao<LocalFavoriteInfo> {
|
||||
|
||||
@Query("DELETE FROM LOCAL_FAVORITES WHERE GID = :gid")
|
||||
void deleteByKey(long gid);
|
||||
|
||||
@Query("SELECT * FROM LOCAL_FAVORITES ORDER BY TIME DESC")
|
||||
List<LocalFavoriteInfo> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(LocalFavoriteInfo t);
|
||||
}
|
||||
@@ -27,10 +27,4 @@ public interface QuickSearchDao extends BasicDao<QuickSearch> {
|
||||
|
||||
@Delete
|
||||
void delete(QuickSearch quickSearch);
|
||||
|
||||
@Query("SELECT * FROM QUICK_SEARCH ORDER BY TIME ASC")
|
||||
List<QuickSearch> fakeList();
|
||||
|
||||
@Insert
|
||||
void fakeInsert(QuickSearch t);
|
||||
}
|
||||
Reference in new issue
Block a user