diff options
6 files changed, 52 insertions, 4 deletions
diff --git a/subsonic-android/res/drawable-hdpi-v4/list_item_more_shaded.9.png b/subsonic-android/res/drawable-hdpi-v4/list_item_more_shaded.9.png Binary files differnew file mode 100644 index 00000000..61d51459 --- /dev/null +++ b/subsonic-android/res/drawable-hdpi-v4/list_item_more_shaded.9.png diff --git a/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java b/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java index 3762d346..421226cf 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java @@ -35,6 +35,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Environment; import android.util.Log; +import github.daneren2005.dsub.domain.Artist; import github.daneren2005.dsub.domain.MusicDirectory; /** @@ -112,15 +113,23 @@ public class FileUtil { ensureDirectoryExistsAndIsReadWritable(new File(albumArtDir, ".nomedia")); return albumArtDir; } + + public static File getArtistDirectory(Context context, Artist artist) { + File dir = new File(getMusicDirectory(context).getPath() + "/" + fileSystemSafe(artist.getName())); + return dir; + } - private static File getAlbumDirectory(Context context, MusicDirectory.Entry entry) { + public static File getAlbumDirectory(Context context, MusicDirectory.Entry entry) { File dir; if (entry.getPath() != null) { File f = new File(fileSystemSafeDir(entry.getPath())); dir = new File(getMusicDirectory(context).getPath() + "/" + (entry.isDirectory() ? f.getPath() : f.getParent())); } else { String artist = fileSystemSafe(entry.getArtist()); - String album = fileSystemSafe(entry.getAlbum()); + String album = fileSystemSafe(entry.getAlbum()); + if("unnamed".equals(album)) { + album = fileSystemSafe(entry.getTitle()); + } dir = new File(getMusicDirectory(context).getPath() + "/" + artist + "/" + album); } return dir; diff --git a/subsonic-android/src/github/daneren2005/dsub/view/AlbumView.java b/subsonic-android/src/github/daneren2005/dsub/view/AlbumView.java index 6415984f..1f3681ec 100644 --- a/subsonic-android/src/github/daneren2005/dsub/view/AlbumView.java +++ b/subsonic-android/src/github/daneren2005/dsub/view/AlbumView.java @@ -19,6 +19,7 @@ package github.daneren2005.dsub.view; import android.content.Context; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageButton; @@ -26,8 +27,10 @@ import android.widget.ImageView; import android.widget.TextView; import github.daneren2005.dsub.R; import github.daneren2005.dsub.domain.MusicDirectory; +import github.daneren2005.dsub.util.FileUtil; import github.daneren2005.dsub.util.ImageLoader; import github.daneren2005.dsub.util.Util; +import java.io.File; /** * Used to display albums in a {@code ListView}. * @@ -35,7 +38,8 @@ import github.daneren2005.dsub.util.Util; */ public class AlbumView extends UpdateView { private static final String TAG = AlbumView.class.getSimpleName(); - + + private Context context; private MusicDirectory.Entry album; private TextView titleView; @@ -46,6 +50,7 @@ public class AlbumView extends UpdateView { public AlbumView(Context context) { super(context); + this.context = context; LayoutInflater.from(context).inflate(R.layout.album_list_item, this, true); titleView = (TextView) findViewById(R.id.album_title); @@ -78,5 +83,12 @@ public class AlbumView extends UpdateView { @Override protected void update() { starButton.setVisibility((Util.isOffline(getContext()) || !album.isStarred()) ? View.GONE : View.VISIBLE); + File file = FileUtil.getAlbumDirectory(context, album); + Log.d(TAG, file.getPath()); + if(file.exists()) { + moreButton.setImageResource(R.drawable.list_item_more_shaded); + } else { + moreButton.setImageResource(R.drawable.list_item_more); + } } } diff --git a/subsonic-android/src/github/daneren2005/dsub/view/ArtistView.java b/subsonic-android/src/github/daneren2005/dsub/view/ArtistView.java index 86c39d14..353be618 100644 --- a/subsonic-android/src/github/daneren2005/dsub/view/ArtistView.java +++ b/subsonic-android/src/github/daneren2005/dsub/view/ArtistView.java @@ -26,7 +26,9 @@ import android.widget.ImageView; import android.widget.TextView;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.Artist;
+import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Util;
+import java.io.File;
/**
* Used to display albums in a {@code ListView}.
@@ -36,6 +38,7 @@ import github.daneren2005.dsub.util.Util; public class ArtistView extends UpdateView {
private static final String TAG = ArtistView.class.getSimpleName();
+ private Context context;
private Artist artist;
private TextView titleView;
@@ -44,6 +47,7 @@ public class ArtistView extends UpdateView { public ArtistView(Context context) {
super(context);
+ this.context = context;
LayoutInflater.from(context).inflate(R.layout.artist_list_item, this, true);
titleView = (TextView) findViewById(R.id.artist_name);
@@ -70,5 +74,11 @@ public class ArtistView extends UpdateView { @Override
protected void update() {
starButton.setVisibility((Util.isOffline(getContext()) || !artist.isStarred()) ? View.GONE : View.VISIBLE);
+ File file = FileUtil.getArtistDirectory(context, artist);
+ if(file.exists()) {
+ moreButton.setImageResource(R.drawable.list_item_more_shaded);
+ } else {
+ moreButton.setImageResource(R.drawable.list_item_more);
+ }
}
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/PlaylistView.java b/subsonic-android/src/github/daneren2005/dsub/view/PlaylistView.java index a34cfa06..b09c91d4 100644 --- a/subsonic-android/src/github/daneren2005/dsub/view/PlaylistView.java +++ b/subsonic-android/src/github/daneren2005/dsub/view/PlaylistView.java @@ -25,6 +25,9 @@ import android.widget.ImageView; import android.widget.TextView;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.Playlist;
+import github.daneren2005.dsub.util.FileUtil;
+import github.daneren2005.dsub.util.Util;
+import java.io.File;
/**
* Used to display albums in a {@code ListView}.
@@ -56,5 +59,16 @@ public class PlaylistView extends UpdateView { this.playlist = playlist;
titleView.setText(playlist.getName());
+ update();
+ }
+
+ @Override
+ protected void update() {
+ File file = FileUtil.getPlaylistFile(playlist.getName());
+ if(file.exists()) {
+ moreButton.setImageResource(R.drawable.list_item_more_shaded);
+ } else {
+ moreButton.setImageResource(R.drawable.list_item_more);
+ }
}
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java index 582cc88c..013edcb8 100644 --- a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java +++ b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java @@ -119,7 +119,10 @@ public class SongView extends UpdateView implements Checkable { if (downloadFile.isWorkDone()) { leftImage = downloadFile.shouldSave() ? R.drawable.saved : R.drawable.downloaded; - } + moreButton.setImageResource(R.drawable.list_item_more_shaded); + } else { + moreButton.setImageResource(R.drawable.list_item_more); + } if (downloadFile.isDownloading() && !downloadFile.isDownloadCancelled() && partialFile.exists()) { statusTextView.setText(Util.formatLocalizedBytes(partialFile.length(), getContext())); |