Add Show Artist context menu item when using ID3 tags. Sort Genres to fix indexing.

This commit is contained in:
Joshua Bahnsen 2013-12-30 14:04:20 -07:00
parent de41e8c9b9
commit a11c88d3af
6 changed files with 46 additions and 1 deletions

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:a="http://schemas.android.com/apk/res/android">
<item
a:id="@+id/menu_show_artist"
a:title="@string/download.menu_show_artist"/>
<item
a:id="@+id/menu_show_album"
a:title="@string/download.menu_show_album"/>

View File

@ -371,6 +371,7 @@
<string name="select_album_all_songs">All Songs by %s</string>
<string name="settings.show_all_songs_by_artist">Show All Songs By Artist</string>
<string name="settings.show_all_songs_by_artist_summary">Add new entry in artist view to access all songs for an artist</string>
<string name="download.menu_show_artist">Show Artist</string>
<plurals name="select_album_n_songs">
<item quantity="zero">Aucun titre</item>

View File

@ -371,6 +371,7 @@
<string name="select_album_all_songs">All Songs by %s</string>
<string name="settings.show_all_songs_by_artist">Show All Songs By Artist</string>
<string name="settings.show_all_songs_by_artist_summary">Add new entry in artist view to access all songs for an artist</string>
<string name="download.menu_show_artist">Show Artist</string>
<plurals name="select_album_n_songs">
<item quantity="zero">Nincsenek dalok</item>

View File

@ -371,6 +371,7 @@
<string name="select_album_all_songs">All Songs by %s</string>
<string name="settings.show_all_songs_by_artist">Show All Songs By Artist</string>
<string name="settings.show_all_songs_by_artist_summary">Add new entry in artist view to access all songs for an artist</string>
<string name="download.menu_show_artist">Show Artist</string>
<plurals name="select_album_n_songs">
<item quantity="zero">No songs</item>

View File

@ -808,6 +808,17 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
menuItem.setVisible(false);
}
}
if (Util.isOffline(this) || !Util.getShouldUseId3Tags(this))
{
MenuItem menuItem = menu.findItem(R.id.menu_show_artist);
if (menuItem != null)
{
menuItem.setVisible(false);
}
}
if (Util.isOffline(this))
{
MenuItem menuItem = menu.findItem(R.id.menu_lyrics);
@ -852,6 +863,23 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
switch (menuItemId)
{
case R.id.menu_show_artist:
if (entry == null)
{
return false;
}
if (Util.getShouldUseId3Tags(DownloadActivity.this))
{
Intent intent = new Intent(DownloadActivity.this, SelectAlbumActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_ID, entry.getArtistId());
intent.putExtra(Constants.INTENT_EXTRA_NAME_NAME, entry.getArtist());
intent.putExtra(Constants.INTENT_EXTRA_NAME_PARENT_ID, entry.getArtistId());
intent.putExtra(Constants.INTENT_EXTRA_NAME_ARTIST, true);
Util.startActivityWithoutTransition(DownloadActivity.this, intent);
}
return true;
case R.id.menu_show_album:
if (entry == null)
{

View File

@ -44,6 +44,8 @@ import com.thejoshwa.ultrasonic.androidapp.util.Util;
import org.apache.http.HttpResponse;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -414,6 +416,15 @@ public class CachedMusicService implements MusicService
cachedGenres.set(result);
}
Collections.sort(result, new Comparator<Genre>()
{
@Override
public int compare(Genre genre, Genre genre2)
{
return genre.getName().compareToIgnoreCase(genre2.getName());
}
});
return result;
}