Add the concept of a FeedItem that is "in progress"

A FeedItem should be considered "in progress" when the user started
listening or watching the media, but did not complete it yet.
This commit is contained in:
Michael Kaiser 2012-10-23 14:50:19 +02:00
parent 56a06f98eb
commit 27fe652551
3 changed files with 23 additions and 0 deletions

View File

@ -82,6 +82,21 @@ public class Feed extends FeedFile {
return count;
}
/**
* Returns the number of FeedItems where the media started to play but
* wasn't finished yet.
* */
public int getNumOfStartedItems() {
int count = 0;
for (FeedItem item : items) {
if (item.isInProgress()) {
count++;
}
}
return count;
}
/**
* Returns true if at least one item in the itemlist is unread.If the
* 'display only episodes' - preference is set to true, this method will

View File

@ -128,6 +128,10 @@ public class FeedItem extends FeedComponent {
return read;
}
public boolean isInProgress() {
return (media != null && media.isInProgress());
}
public String getContentEncoded() {
return contentEncoded;
}

View File

@ -118,4 +118,8 @@ public class FeedMedia extends FeedFile {
this.playbackCompletionDate = playbackCompletionDate;
}
public boolean isInProgress() {
return (this.position > 0 && this.playbackCompletionDate == null);
}
}