From 7f43eb0bac0a22ae9f3f4a536c4968f901567170 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 29 Apr 2014 07:34:14 -0700 Subject: Don't show artist when viewing a single artist --- .../dsub/fragments/SelectDirectoryFragment.java | 4 ++-- src/github/daneren2005/dsub/view/AlbumCell.java | 22 ++++++++++++++++------ .../daneren2005/dsub/view/AlbumGridAdapter.java | 5 ++++- 3 files changed, 22 insertions(+), 9 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 948654c4..3754409f 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -655,9 +655,9 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter entryList.setAdapter(new AlbumListAdapter(context, entryAdapter, albumListType, albumListExtra, albumListSize)); } else if(albumListType == null || "starred".equals(albumListType)) { - albumList.setAdapter(new AlbumGridAdapter(context, getImageLoader(), albums)); + albumList.setAdapter(new AlbumGridAdapter(context, getImageLoader(), albums, !artist)); } else { - albumList.setAdapter(new AlbumListAdapter(context, new AlbumGridAdapter(context, getImageLoader(), albums), albumListType, albumListExtra, albumListSize)); + albumList.setAdapter(new AlbumListAdapter(context, new AlbumGridAdapter(context, getImageLoader(), albums, true), albumListType, albumListExtra, albumListSize)); } entryList.setVisibility(View.VISIBLE); context.supportInvalidateOptionsMenu(); diff --git a/src/github/daneren2005/dsub/view/AlbumCell.java b/src/github/daneren2005/dsub/view/AlbumCell.java index 9cee0c41..7cfe33f6 100644 --- a/src/github/daneren2005/dsub/view/AlbumCell.java +++ b/src/github/daneren2005/dsub/view/AlbumCell.java @@ -39,6 +39,7 @@ public class AlbumCell extends UpdateView { private View coverArtView; private TextView titleView; private TextView artistView; + private boolean showArtist = true; public AlbumCell(Context context) { super(context); @@ -56,6 +57,10 @@ public class AlbumCell extends UpdateView { }); } + public void setShowArtist(boolean showArtist) { + this.showArtist = showArtist; + } + protected void setObjectImpl(Object obj1, Object obj2) { this.album = (MusicDirectory.Entry) obj1; if(album.getAlbum() == null) { @@ -63,12 +68,17 @@ public class AlbumCell extends UpdateView { } else { titleView.setText(album.getAlbum()); } - String artist = album.getArtist(); - if(artist == null) { - artist = ""; - } - if(album.getYear() != null) { - artist += " - " + album.getYear(); + String artist = ""; + if(showArtist) { + artist = album.getArtist(); + if (artist == null) { + artist = ""; + } + if (album.getYear() != null) { + artist += " - " + album.getYear(); + } + } else if(album.getYear() != null) { + artist += album.getYear(); } artistView.setText(artist); artistView.setVisibility(album.getArtist() == null ? View.GONE : View.VISIBLE); diff --git a/src/github/daneren2005/dsub/view/AlbumGridAdapter.java b/src/github/daneren2005/dsub/view/AlbumGridAdapter.java index 3c81fa9a..ca7c089d 100644 --- a/src/github/daneren2005/dsub/view/AlbumGridAdapter.java +++ b/src/github/daneren2005/dsub/view/AlbumGridAdapter.java @@ -30,12 +30,14 @@ public class AlbumGridAdapter extends ArrayAdapter { private final Context activity; private final ImageLoader imageLoader; private List entries; + private boolean showArtist; - public AlbumGridAdapter(Context activity, ImageLoader imageLoader, List entries) { + public AlbumGridAdapter(Context activity, ImageLoader imageLoader, List entries, boolean showArtist) { super(activity, android.R.layout.simple_list_item_1, entries); this.entries = entries; this.activity = activity; this.imageLoader = imageLoader; + this.showArtist = showArtist; } @Override @@ -49,6 +51,7 @@ public class AlbumGridAdapter extends ArrayAdapter { view = new AlbumCell(activity); } + view.setShowArtist(showArtist); view.setObject(entry, imageLoader); return view; } -- cgit v1.2.3