aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-11-26 13:29:39 -0800
committerdaneren2005 <daneren2005@gmail.com>2013-11-26 13:29:39 -0800
commit03537e766afd676c6e4a2846bc6a640cb734cfde (patch)
tree2bf774b727a67cfd672df67442e23437310bb4e3 /src/github
parent3349971b995c7b8f9a71404a24581728acf0e5b2 (diff)
downloaddsub-03537e766afd676c6e4a2846bc6a640cb734cfde.tar.gz
dsub-03537e766afd676c6e4a2846bc6a640cb734cfde.tar.bz2
dsub-03537e766afd676c6e4a2846bc6a640cb734cfde.zip
Break metadata editing out into easy to override function
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java b/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java
index a47ecab5..1b4419d9 100644
--- a/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java
+++ b/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java
@@ -54,17 +54,9 @@ public class RemoteControlClientICS extends RemoteControlClientHelper {
}
// Update the remote controls
- mRemoteControl.editMetadata(true)
- .putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, (currentSong == null) ? null : currentSong.getArtist())
- .putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, (currentSong == null) ? null : currentSong.getAlbum())
- .putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, (currentSong == null) ? null : currentSong.getArtist())
- .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, (currentSong) == null ? null : currentSong.getTitle())
- .putString(MediaMetadataRetriever.METADATA_KEY_GENRE, (currentSong) == null ? null : currentSong.getGenre())
- .putLong(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER, (currentSong == null) ?
- 0 : ((currentSong.getTrack() == null) ? 0 : currentSong.getTrack()))
- .putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, (currentSong == null) ?
- 0 : ((currentSong.getDuration() == null) ? 0 : currentSong.getDuration()))
- .apply();
+ RemoteControlClient.MetadataEditor editor = mRemoteControl.editMetadata(true);
+ updateMetadata(currentSong, editor);
+ editor.apply();
if (currentSong == null || imageLoader == null) {
mRemoteControl.editMetadata(true)
.putBitmap(RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, null)
@@ -73,6 +65,17 @@ public class RemoteControlClientICS extends RemoteControlClientHelper {
imageLoader.loadImage(context, mRemoteControl, currentSong);
}
}
+ protected void updateMetadata(final MusicDirectory.Entry currentSong, final RemoteControlClient.MetadataEditor editor) {
+ editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, (currentSong == null) ? null : currentSong.getArtist())
+ .putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, (currentSong == null) ? null : currentSong.getAlbum())
+ .putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, (currentSong == null) ? null : currentSong.getArtist())
+ .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, (currentSong) == null ? null : currentSong.getTitle())
+ .putString(MediaMetadataRetriever.METADATA_KEY_GENRE, (currentSong) == null ? null : currentSong.getGenre())
+ .putLong(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER, (currentSong == null) ?
+ 0 : ((currentSong.getTrack() == null) ? 0 : currentSong.getTrack()))
+ .putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, (currentSong == null) ?
+ 0 : ((currentSong.getDuration() == null) ? 0 : currentSong.getDuration()));
+ }
protected int getTransportFlags() {
return RemoteControlClient.FLAG_KEY_MEDIA_PLAY |