diff --git a/db/src/main/java/com/readrops/db/dao/FeedDao.java b/db/src/main/java/com/readrops/db/dao/FeedDao.java index 072a4b5b..12e78923 100644 --- a/db/src/main/java/com/readrops/db/dao/FeedDao.java +++ b/db/src/main/java/com/readrops/db/dao/FeedDao.java @@ -62,10 +62,9 @@ public abstract class FeedDao implements BaseDao { @Query("Update Feed set text_color = :textColor, background_color = :bgColor Where id = :feedId") public abstract void updateColors(int feedId, int textColor, int bgColor); - @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH) @Query("Select Feed.name as feed_name, Feed.id as feed_id, Folder.name as folder_name, Folder.id as folder_id, Folder.remoteId as folder_remoteId, Folder.account_id as folder_account_id," + - "Feed.description as feed_description, Feed.icon_url as feed_icon_url, Feed.url as feed_url, Feed.folder_id as feed_folder_id" + - ", Feed.siteUrl as feed_siteUrl, Feed.remoteId as feed_remoteId from Feed Left Join Folder on Feed.folder_id = Folder.id Where Feed.account_id = :accountId Order by Feed.name") + "Feed.description as feed_description, Feed.icon_url as feed_icon_url, Feed.url as feed_url, Feed.folder_id as feed_folder_id, Feed.text_color as feed_text_color, Feed.background_color as feed_background_color" + + ", Feed.account_id as feed_account_id, Feed.notification_enabled as feed_notification_enabled, Feed.siteUrl as feed_siteUrl, Feed.remoteId as feed_remoteId from Feed Left Join Folder on Feed.folder_id = Folder.id Where Feed.account_id = :accountId Order by Feed.name") public abstract LiveData> getAllFeedsWithFolder(int accountId); @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH) diff --git a/db/src/main/java/com/readrops/db/pojo/FeedWithFolder.java b/db/src/main/java/com/readrops/db/pojo/FeedWithFolder.java deleted file mode 100644 index 6f0316b9..00000000 --- a/db/src/main/java/com/readrops/db/pojo/FeedWithFolder.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.readrops.db.pojo; - -import android.os.Parcel; -import android.os.Parcelable; - -import androidx.room.Embedded; - -import com.readrops.db.entities.Feed; -import com.readrops.db.entities.Folder; - -public class FeedWithFolder implements Parcelable { - - @Embedded(prefix = "feed_") - private Feed feed; - - @Embedded(prefix = "folder_") - private Folder folder; - - public FeedWithFolder() { - - } - - protected FeedWithFolder(Parcel in) { - feed = in.readParcelable(Feed.class.getClassLoader()); - folder = in.readParcelable(Folder.class.getClassLoader()); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(feed, flags); - dest.writeParcelable(folder, flags); - } - - @Override - public int describeContents() { - return 0; - } - - public static final Creator CREATOR = new Creator() { - @Override - public FeedWithFolder createFromParcel(Parcel in) { - return new FeedWithFolder(in); - } - - @Override - public FeedWithFolder[] newArray(int size) { - return new FeedWithFolder[size]; - } - }; - - public Feed getFeed() { - return feed; - } - - public void setFeed(Feed feed) { - this.feed = feed; - } - - public Folder getFolder() { - return folder; - } - - public void setFolder(Folder folder) { - this.folder = folder; - } - - -} diff --git a/db/src/main/java/com/readrops/db/pojo/FeedWithFolder.kt b/db/src/main/java/com/readrops/db/pojo/FeedWithFolder.kt new file mode 100644 index 00000000..dd78e3d7 --- /dev/null +++ b/db/src/main/java/com/readrops/db/pojo/FeedWithFolder.kt @@ -0,0 +1,13 @@ +package com.readrops.db.pojo + +import android.os.Parcelable +import androidx.room.Embedded +import com.readrops.db.entities.Feed +import com.readrops.db.entities.Folder +import kotlinx.parcelize.Parcelize + +@Parcelize +data class FeedWithFolder( + @Embedded(prefix = "feed_") val feed: Feed, + @Embedded(prefix = "folder_") val folder: Folder, +) : Parcelable \ No newline at end of file