Recently played is now history. Songs are always added to the history but their play count will be only increased if they were played at least half. This makes the top tracks much more accurate.

This commit is contained in:
Karim Abou Zeid 2015-09-12 15:14:01 +02:00
commit cf4ed6d5c0
10 changed files with 163 additions and 31 deletions

View file

@ -23,7 +23,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.kabouzeid.gramophone.model.Song;
import com.kabouzeid.gramophone.provider.RecentlyPlayedStore;
import com.kabouzeid.gramophone.provider.HistoryStore;
import com.kabouzeid.gramophone.provider.SongPlayCountStore;
import java.util.ArrayList;
@ -50,7 +50,7 @@ public class TopAndRecentlyPlayedTracksLoader {
ArrayList<Long> missingIds = retCursor.getMissingIds();
if (missingIds != null && missingIds.size() > 0) {
for (long id : missingIds) {
RecentlyPlayedStore.getInstance(context).removeSongId(id);
HistoryStore.getInstance(context).removeSongId(id);
}
}
}
@ -76,11 +76,11 @@ public class TopAndRecentlyPlayedTracksLoader {
@Nullable
private static SortedCursor makeRecentTracksCursorImpl(@NonNull final Context context) {
// first get the top results ids from the internal database
Cursor songs = RecentlyPlayedStore.getInstance(context).queryRecentIds();
Cursor songs = HistoryStore.getInstance(context).queryRecentIds();
try {
return makeSortedCursor(context, songs,
songs.getColumnIndex(RecentlyPlayedStore.RecentStoreColumns.ID));
songs.getColumnIndex(HistoryStore.RecentStoreColumns.ID));
} finally {
if (songs != null) {
songs.close();