From 8bd8ba0244436a809cfecde8122a7b2a1c525145 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 11 Dec 2015 18:02:45 -0800 Subject: If case of multiple identical paths offline, show last played as most recent one --- app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java b/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java index e7716b49..ba0851c2 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java +++ b/app/src/main/java/github/daneren2005/dsub/util/SongDBHandler.java @@ -116,7 +116,6 @@ public class SongDBHandler extends SQLiteOpenHelper { } public Long[] getLastPlayed(MusicDirectory.Entry entry) { - // TODO: In case of offline want to get most recent played match return getLastPlayed(getOnlineSongId(entry)); } protected Long[] getLastPlayed(Pair pair) { @@ -171,7 +170,7 @@ public class SongDBHandler extends SQLiteOpenHelper { SQLiteDatabase db = this.getReadableDatabase(); String[] columns = {SONGS_SERVER_KEY, SONGS_SERVER_ID}; - Cursor cursor = db.query(TABLE_SONGS, columns, SONGS_COMPLETE_PATH + " = ?", new String[] { path }, null, null, null, null); + Cursor cursor = db.query(TABLE_SONGS, columns, SONGS_COMPLETE_PATH + " = ?", new String[] { path }, null, null, SONGS_LAST_PLAYED + " DESC", null); try { cursor.moveToFirst(); -- cgit v1.2.3