diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-10-05 17:24:29 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-10-05 17:24:29 -0700 |
commit | 4e4963ed23413543e2bc1b95343e8b34d913207d (patch) | |
tree | 3b116f53224e7794fea745e53c721885fe63f07a /app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java | |
parent | f106f414f8c525bf31914b32d03f9a9f2ec4f5af (diff) | |
download | dsub-4e4963ed23413543e2bc1b95343e8b34d913207d.tar.gz dsub-4e4963ed23413543e2bc1b95343e8b34d913207d.tar.bz2 dsub-4e4963ed23413543e2bc1b95343e8b34d913207d.zip |
#559 Fix queue saving trying to save offline id's
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java index 42aa5288..42c97b9e 100644 --- a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java @@ -20,6 +20,7 @@ package github.daneren2005.dsub.domain; import android.annotation.TargetApi; import android.content.Context; +import android.content.SharedPreferences; import android.media.MediaMetadataRetriever; import android.os.Build; import android.util.Log; @@ -525,6 +526,18 @@ public class MusicDirectory implements Serializable { this.closeness = closeness; } + public boolean isOnlineId(Context context) { + try { + String cacheLocation = Util.getPreferences(context).getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null); + return cacheLocation == null || id == null || id.indexOf(cacheLocation) == -1; + } catch(Exception e) { + Log.w(TAG, "Failed to check online id validity"); + + // Err on the side of default functionality + return true; + } + } + @Override public boolean equals(Object o) { if (this == o) { |