mirror of https://github.com/readrops/Readrops.git
Migrate FeedWithFolder to kotlin
This commit is contained in:
parent
80404bb648
commit
bb24daff64
|
@ -62,10 +62,9 @@ public abstract class FeedDao implements BaseDao<Feed> {
|
|||
@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<List<FeedWithFolder>> getAllFeedsWithFolder(int accountId);
|
||||
|
||||
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
|
||||
|
|
|
@ -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<FeedWithFolder> CREATOR = new Creator<FeedWithFolder>() {
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue