[Android] Audio player: display the cover if the media has one
Adrien Maglo
git at videolan.org
Thu Nov 28 11:54:31 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Nov 28 11:54:19 2013 +0100| [bf5b9a50dd230d95ba10a38ca438773c1cddfbc0] | committer: Adrien Maglo
Audio player: display the cover if the media has one
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=bf5b9a50dd230d95ba10a38ca438773c1cddfbc0
---
.../src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
index 4dc3c1f..33af550 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
@@ -58,6 +58,7 @@ import android.widget.Toast;
public class AudioPlayerFragment extends SherlockFragment implements IAudioPlayer {
public final static String TAG = "VLC/AudioPlayerFragment";
+ private ImageView mCover;
private TextView mTitle;
private TextView mArtist;
private TextView mTime;
@@ -98,6 +99,7 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.audio_player, container, false);
+ mCover = (ImageView) v.findViewById(R.id.cover);
mTitle = (TextView) v.findViewById(R.id.title);
mArtist = (TextView) v.findViewById(R.id.artist);
mTime = (TextView) v.findViewById(R.id.time);
@@ -278,10 +280,12 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
String title = mAudioController.getTitle();
if (title != null && !title.equals(lastTitle)) {
Bitmap cover = mAudioController.getCover();
- /*if (cover != null)
+ if (cover != null) {
+ mCover.setVisibility(ImageView.VISIBLE);
mCover.setImageBitmap(cover);
- else
- mCover.setImageResource(R.drawable.cone);*/
+ } else {
+ mCover.setVisibility(ImageView.GONE);
+ }
}
lastTitle = title;
mTitle.setText(lastTitle);
More information about the Android
mailing list