Fixed refreshing playlist on HTTP connections (#740)
When Kore retrieves the data over HTTP the playlist would be refreshed every 4 seconds. This caused the playlist to jump to the top when scrolled down. This has been fixed by checking if the new playlist is different from the current playlist. If not nothing changes.
This commit is contained in:
parent
a9a833ddfe
commit
6ed64bf9f9
|
@ -594,9 +594,12 @@ public class HostConnectionObserver
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(hostState.lastGetPlaylistResults != null &&
|
||||||
|
hostState.lastGetPlaylistResults.equals(result))) {
|
||||||
for (PlaylistEventsObserver observer : playlistEventsObservers) {
|
for (PlaylistEventsObserver observer : playlistEventsObservers) {
|
||||||
observer.playlistsAvailable(result);
|
observer.playlistsAvailable(result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle cleared playlists
|
// Handle cleared playlists
|
||||||
if (hostState.lastGetPlaylistResults != null) {
|
if (hostState.lastGetPlaylistResults != null) {
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
package org.xbmc.kore.host.actions;
|
package org.xbmc.kore.host.actions;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.xbmc.kore.jsonrpc.ApiMethod;
|
import org.xbmc.kore.jsonrpc.ApiMethod;
|
||||||
import org.xbmc.kore.jsonrpc.HostConnection;
|
import org.xbmc.kore.jsonrpc.HostConnection;
|
||||||
import org.xbmc.kore.jsonrpc.method.Playlist;
|
import org.xbmc.kore.jsonrpc.method.Playlist;
|
||||||
|
@ -172,5 +174,11 @@ public class GetPlaylist implements Callable<ArrayList<GetPlaylist.GetPlaylistRe
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
return obj instanceof GetPlaylistResult &&
|
||||||
|
this.items.equals(((GetPlaylistResult) obj).items);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,13 @@ package org.xbmc.kore.jsonrpc.type;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
|
import org.xbmc.kore.host.actions.GetPlaylist;
|
||||||
import org.xbmc.kore.utils.JsonUtils;
|
import org.xbmc.kore.utils.JsonUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -287,6 +290,12 @@ public class ListType {
|
||||||
writer = JsonUtils.stringListFromJsonNode(node, WRITER);
|
writer = JsonUtils.stringListFromJsonNode(node, WRITER);
|
||||||
year = JsonUtils.intFromJsonNode(node, YEAR, -1);
|
year = JsonUtils.intFromJsonNode(node, YEAR, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
return obj instanceof ItemBase &&
|
||||||
|
this.id == ((ItemBase) obj).id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ItemsAll extends ItemBase {
|
public static class ItemsAll extends ItemBase {
|
||||||
|
|
Loading…
Reference in New Issue