Add abstract methods in PlaylistLocalItem & rename setIsModified

This commit is contained in:
GGAutomaton 2022-06-23 19:20:16 +08:00
parent ba394a7ab4
commit 9ecef6f011
9 changed files with 38 additions and 23 deletions

View file

@ -13,6 +13,10 @@ public interface PlaylistLocalItem extends LocalItem {
long getDisplayIndex();
long getUid();
void setDisplayIndex(long displayIndex);
/**
* Merge localPlaylists and remotePlaylists by the display index.
* If two items have the same display index, sort them in {@code CASE_INSENSITIVE_ORDER}.

View file

@ -11,13 +11,13 @@ public class PlaylistMetadataEntry implements PlaylistLocalItem {
public static final String PLAYLIST_STREAM_COUNT = "streamCount";
@ColumnInfo(name = PLAYLIST_ID)
public final long uid;
private final long uid;
@ColumnInfo(name = PLAYLIST_NAME)
public final String name;
@ColumnInfo(name = PLAYLIST_THUMBNAIL_URL)
public final String thumbnailUrl;
@ColumnInfo(name = PLAYLIST_DISPLAY_INDEX)
public long displayIndex;
private long displayIndex;
@ColumnInfo(name = PLAYLIST_STREAM_COUNT)
public final long streamCount;
@ -44,4 +44,14 @@ public class PlaylistMetadataEntry implements PlaylistLocalItem {
public long getDisplayIndex() {
return displayIndex;
}
@Override
public long getUid() {
return uid;
}
@Override
public void setDisplayIndex(final long displayIndex) {
this.displayIndex = displayIndex;
}
}

View file

@ -41,10 +41,10 @@ public class PlaylistEntity {
@Ignore
public PlaylistEntity(final PlaylistMetadataEntry item) {
this.uid = item.uid;
this.uid = item.getUid();
this.name = item.name;
this.thumbnailUrl = item.thumbnailUrl;
this.displayIndex = item.displayIndex;
this.displayIndex = item.getDisplayIndex();
}
public long getUid() {

View file

@ -105,6 +105,7 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem {
&& TextUtils.equals(getUploader(), info.getUploaderName());
}
@Override
public long getUid() {
return uid;
}
@ -158,6 +159,7 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem {
return displayIndex;
}
@Override
public void setDisplayIndex(final long displayIndex) {
this.displayIndex = displayIndex;
}