Commit f02beed4 authored by Daniel Sonck's avatar Daniel Sonck
Browse files

Merge pull request #18 in THFM/fm.touhou.touhoufm from...

Merge pull request #18 in THFM/fm.touhou.touhoufm from bugfix/THFMA-13-crash-on-play-before-song-information to development

* commit '2ce3042b':
  Fixing crash on play without internet
parents 97dafce4 2ce3042b
......@@ -77,6 +77,23 @@ public final class MediaPlayerAdapter extends PlayerAdapter implements APIClient
super(context);
mContext = context;
mPlaybackInfoListener = listener;
MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
builder.putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, "-1");
String songTitle = mContext.getString(R.string.unknown_song);
builder.putString(MediaMetadataCompat.METADATA_KEY_TITLE, songTitle);
builder.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, mContext.getString(R.string.unknown_album));
String songArtist = mContext.getString(R.string.unknown_artist);
builder.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, songArtist);
String songCircle = mContext.getString(R.string.unknown_circle);
builder.putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST, songCircle);
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, songTitle);
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE, String.format(mContext.getString(R.string.artist_circle_format), songArtist, songCircle));
mCurrentMedia = builder.build();
mPlaybackInfoListener.onMetadataChange(mCurrentMedia);
mApiClient = new APIClient(this);
mApiClient.connect();
......
......@@ -41,4 +41,8 @@
<string name="time_format">%2$d:%1$02d</string>
<string name="album_format">( %s )</string>
<string name="artist_circle_format">%s ( %s )</string>
<string name="unknown_song">Unknown Song</string>
<string name="unknown_album">Unknown Album</string>
<string name="unknown_artist">Unknown Artist</string>
<string name="unknown_circle">Unknown Circle</string>
</resources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment