mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Implemented rating system for song, album and artist (album and artist do not retrieve rating from server)
This commit is contained in:
parent
055ac44cf6
commit
e2ddbdf6c9
15 changed files with 303 additions and 7 deletions
|
|
@ -42,6 +42,7 @@ public class Song implements Parcelable {
|
|||
private long added;
|
||||
private int playCount;
|
||||
private long lastPlay;
|
||||
private int rating;
|
||||
|
||||
public Song() {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
|
|
@ -67,6 +68,7 @@ public class Song implements Parcelable {
|
|||
this.added = child.getCreated().getTime();
|
||||
this.playCount = 0;
|
||||
this.lastPlay = 0;
|
||||
this.rating = child.getUserRating() != null ? child.getUserRating() : 0;
|
||||
}
|
||||
|
||||
public Song(Queue queue) {
|
||||
|
|
@ -251,14 +253,22 @@ public class Song implements Parcelable {
|
|||
this.playCount = playCount;
|
||||
}
|
||||
|
||||
public int getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(int rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
/*
|
||||
Log.i(TAG, "increasePlayCount: " + isIncreased);
|
||||
* Incremento il numero di ascolti solo se ho ascoltato la canzone da più tempo di:
|
||||
* tempo dell'ultimo ascolto - (durata_canzone / 2)
|
||||
* Ritorno un booleano
|
||||
* Se vero, allora SongRepository scriverà nd DB l'incremento dell'ascolto
|
||||
* Se falso, SongRepository non scriverà nulla nel db
|
||||
*/
|
||||
Log.i(TAG, "increasePlayCount: " + isIncreased);
|
||||
* Incremento il numero di ascolti solo se ho ascoltato la canzone da più tempo di:
|
||||
* tempo dell'ultimo ascolto - (durata_canzone / 2)
|
||||
* Ritorno un booleano
|
||||
* Se vero, allora SongRepository scriverà nd DB l'incremento dell'ascolto
|
||||
* Se falso, SongRepository non scriverà nulla nel db
|
||||
*/
|
||||
public boolean nowPlaying() {
|
||||
long startPlayTime = Instant.now().toEpochMilli();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue