mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
WIP Added possibility to switch default image when absent the original one
This commit is contained in:
parent
a21a0132bd
commit
2b5a686fe4
23 changed files with 125 additions and 124 deletions
|
|
@ -2,6 +2,7 @@ package com.cappielloantonio.play.model;
|
|||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
|
|
@ -19,6 +20,8 @@ import java.util.UUID;
|
|||
|
||||
@Entity(tableName = "song")
|
||||
public class Song implements Parcelable {
|
||||
private static final String TAG = "SongClass";
|
||||
|
||||
@Ignore
|
||||
public static final String RECENTLY_PLAYED = "RECENTLY_PLAYED";
|
||||
|
||||
|
|
@ -400,9 +403,24 @@ public class Song implements Parcelable {
|
|||
this.playCount = playCount;
|
||||
}
|
||||
|
||||
public void nowPlaying() {
|
||||
this.playCount++;
|
||||
this.lastPlay = Instant.now().toEpochMilli();
|
||||
/*
|
||||
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();
|
||||
|
||||
if(startPlayTime - (getDuration()/2) > getLastPlay()) {
|
||||
this.playCount++;
|
||||
this.lastPlay = startPlayTime;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue