diff --git a/readropsdb/src/main/java/com/readrops/readropsdb/dao/AccountDao.java b/readropsdb/src/main/java/com/readrops/readropsdb/dao/AccountDao.java index ea7d5cdd..55108eae 100644 --- a/readropsdb/src/main/java/com/readrops/readropsdb/dao/AccountDao.java +++ b/readropsdb/src/main/java/com/readrops/readropsdb/dao/AccountDao.java @@ -11,29 +11,29 @@ import java.util.List; import io.reactivex.Single; @Dao -public abstract class AccountDao implements BaseDao { +public interface AccountDao extends BaseDao { @Query("Select * from Account") - public abstract LiveData> selectAllAsync(); + LiveData> selectAllAsync(); @Query("Select * from Account") - public abstract List selectAll(); + List selectAll(); @Query("Update Account set last_modified = :lastModified Where id = :accountId") - public abstract void updateLastModified(int accountId, long lastModified); + void updateLastModified(int accountId, long lastModified); @Query("Update Account set current_account = 0 Where id Not In (:accountId)") - public abstract void deselectOldCurrentAccount(int accountId); + void deselectOldCurrentAccount(int accountId); @Query("Update Account set current_account = 1 Where id = :accountId") - public abstract void setCurrentAccount(int accountId); + void setCurrentAccount(int accountId); @Query("Select count(*) From Account Where account_type = :accountType") - public abstract Integer getAccountCountByType(int accountType); + Integer getAccountCountByType(int accountType); @Query("Select count(*) From Account") - public abstract Single getAccountCount(); + Single getAccountCount(); @Query("Update Account set writeToken = :writeToken Where id = :accountId") - public abstract void updateWriteToken(int accountId, String writeToken); + void updateWriteToken(int accountId, String writeToken); } diff --git a/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java b/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java index 68efda64..bcb5ff2b 100644 --- a/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java +++ b/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java @@ -19,16 +19,16 @@ import java.util.List; import io.reactivex.Completable; @Dao -public abstract class ItemDao implements BaseDao { +public interface ItemDao extends BaseDao { @RawQuery(observedEntities = {Item.class, Folder.class, Feed.class}) - public abstract DataSource.Factory selectAll(SupportSQLiteQuery query); + DataSource.Factory selectAll(SupportSQLiteQuery query); @Query("Select case When :guid In (Select guid From Item Inner Join Feed on Item.feed_id = Feed.id and account_id = :accountId) Then 1 else 0 end") - public abstract boolean itemExists(String guid, int accountId); + boolean itemExists(String guid, int accountId); @Query("Select case When :remoteId In (Select remoteId from Item) And :feedId In (Select feed_id From Item) Then 1 else 0 end") - public abstract boolean remoteItemExists(String remoteId, int feedId); + boolean remoteItemExists(String remoteId, int feedId); /** * Set an item read or unread @@ -38,35 +38,35 @@ public abstract class ItemDao implements BaseDao { * @param readChanged */ @Query("Update Item Set read_changed = :readChanged, read = :read Where id = :itemId") - public abstract Completable setReadState(int itemId, boolean read, boolean readChanged); + Completable setReadState(int itemId, boolean read, boolean readChanged); @Query("Update Item set read_changed = 1, read = :readState Where feed_id In (Select id From Feed Where account_id = :accountId)") - public abstract Completable setAllItemsReadState(int readState, int accountId); + Completable setAllItemsReadState(int readState, int accountId); @Query("Update Item set read_changed = 1, read = :readState Where feed_id = :feedId") - public abstract Completable setAllFeedItemsReadState(int feedId, int readState); + Completable setAllFeedItemsReadState(int feedId, int readState); @Query("Update Item set read_it_later = 1 Where id = :itemId") - public abstract Completable setReadItLater(int itemId); + Completable setReadItLater(int itemId); @Query("Select count(*) From Item Where feed_id = :feedId And read = 0") - public abstract int getUnreadCount(int feedId); + int getUnreadCount(int feedId); @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH) @Query("Select title, Item.description, content, link, pub_date, image_link, author, read, text_color, " + "background_color, read_time, Feed.name, Feed.id as feedId, siteUrl, Folder.id as folder_id, " + "Folder.name as folder_name from Item Inner Join Feed On Item.feed_id = Feed.id Left Join Folder on Folder.id = Feed.folder_id Where Item.id = :id") - public abstract LiveData getItemById(int id); + LiveData getItemById(int id); @Query("Select Item.remoteId From Item Inner Join Feed On Item.feed_id = Feed.id Where read_changed = 1 And read = 1 And account_id = :accountId") - public abstract List getReadChanges(int accountId); + List getReadChanges(int accountId); @Query("Select Item.remoteId From Item Inner Join Feed On Item.feed_id = Feed.id Where read_changed = 1 And read = 0 And account_id = :accountId") - public abstract List getUnreadChanges(int accountId); + List getUnreadChanges(int accountId); @Query("Update Item set read_changed = 0 Where feed_id in (Select id From Feed Where account_id = :accountId)") - public abstract void resetReadChanges(int accountId); + void resetReadChanges(int accountId); @Query("Update Item set read = :read Where remoteId = :remoteId") - public abstract void setReadState(String remoteId, boolean read); + void setReadState(String remoteId, boolean read); }