Add a new smart playlist "Not played lately" playlist (#613)

* Add "Not played lately" playlist (#1)

* Fix bad recent playlist construction (#6)

* Revert History rename

* Code review
This commit is contained in:
soncaokim 2018-12-02 18:30:01 +01:00 committed by Eugene
commit 764751381a
9 changed files with 126 additions and 8 deletions

View file

@ -25,7 +25,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class HistoryStore extends SQLiteOpenHelper {
private static final int MAX_ITEMS_IN_DB = 100;
private static final int MAX_ITEMS_IN_DB = 5000;
public static final String DATABASE_NAME = "history.db";
private static final int VERSION = 1;
@ -136,10 +136,14 @@ public class HistoryStore extends SQLiteOpenHelper {
return containsId;
}
public Cursor queryRecentIds() {
public Cursor queryRecentIds(long cutoff) {
final SQLiteDatabase database = getReadableDatabase();
return database.query(RecentStoreColumns.NAME,
new String[]{RecentStoreColumns.ID}, null, null, null, null,
new String[]{RecentStoreColumns.ID},
RecentStoreColumns.TIME_PLAYED + ">?",
new String[]{String.valueOf(cutoff)},
null, null,
RecentStoreColumns.TIME_PLAYED + " DESC");
}