[Android] TV: Show ArtworkUrl when available
Geoffrey Métais
git at videolan.org
Thu Mar 3 19:16:44 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 3 19:15:35 2016 +0100| [2e40b1cf3b9c811237bc7abc79723991b39db0e0] | committer: Geoffrey Métais
TV: Show ArtworkUrl when available
> https://code.videolan.org/videolan/vlc-android/commit/2e40b1cf3b9c811237bc7abc79723991b39db0e0
---
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 2 +-
vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.java | 11 +++++++++--
.../src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java | 2 +-
vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java | 3 +--
.../org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java | 5 +++--
.../videolan/vlc/gui/tv/browser/SortedBrowserFragment.java | 4 +++-
6 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 3246722..ba3968e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -249,7 +249,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
DetailsActivity.class);
// pass the item information
intent.putExtra("media", (MediaWrapper) mSelectedItem);
- intent.putExtra("item", new MediaItemDetails(media.getTitle(), media.getArtist(), media.getAlbum(), media.getLocation()));
+ intent.putExtra("item", new MediaItemDetails(media.getTitle(), media.getArtist(), media.getAlbum(), media.getLocation(), media.getArtworkURL()));
startActivity(intent);
return true;
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.java b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.java
index f7d4c3a..00986e5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.java
@@ -25,13 +25,14 @@ import android.os.Parcelable;
public class MediaItemDetails implements Parcelable {
- private String title, subTitle, body, location;
+ private String title, subTitle, body, location, artworkUrl;
- public MediaItemDetails(String title, String subTitle, String body, String location) {
+ public MediaItemDetails(String title, String subTitle, String body, String location, String artworkUrl) {
this.title = title;
this.subTitle = subTitle;
this.body = body;
this.location = location;
+ this.artworkUrl = artworkUrl;
}
public String getTitle() {
@@ -50,6 +51,10 @@ public class MediaItemDetails implements Parcelable {
return location;
}
+ public String getArtworkUrl() {
+ return artworkUrl;
+ }
+
@Override
public int describeContents() {
// TODO Auto-generated method stub
@@ -62,6 +67,7 @@ public class MediaItemDetails implements Parcelable {
dest.writeString(subTitle);
dest.writeString(body);
dest.writeString(location);
+ dest.writeString(artworkUrl);
}
public static final Parcelable.Creator<MediaItemDetails> CREATOR
@@ -80,5 +86,6 @@ public class MediaItemDetails implements Parcelable {
subTitle = in.readString();
body = in.readString();
location = in.readString();
+ artworkUrl = in.readString();
}
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java
index d6b92d7..5585936 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java
@@ -119,7 +119,7 @@ public class MediaItemDetailsFragment extends DetailsFragment implements Playbac
startActivity(intent);
break;
case ID_FAVORITE_ADD:
- mDb.addNetworkFavItem(Uri.parse(mMedia.getLocation()), mMedia.getTitle(), null);
+ mDb.addNetworkFavItem(Uri.parse(mMedia.getLocation()), mMedia.getTitle(), mMedia.getArtworkUrl());
detailsOverview.removeAction(actionAdd);
detailsOverview.addAction(actionDelete);
mRowsAdapter.notifyArrayItemRangeChanged(0, mRowsAdapter.size());
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java
index daae4aa..2f19255 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java
@@ -23,7 +23,6 @@ package org.videolan.vlc.gui.tv;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
-import android.os.Parcelable;
import android.support.v17.leanback.widget.Row;
import org.videolan.vlc.gui.tv.audioplayer.AudioPlayerActivity;
@@ -46,7 +45,7 @@ public class TvUtil {
Intent intent = new Intent(activity,
DetailsActivity.class);
// pass the item information
- intent.putExtra("item", (Parcelable) new MediaItemDetails(mediaWrapper.getTitle(), mediaWrapper.getArtist(), mediaWrapper.getAlbum(), mediaWrapper.getLocation()));
+ intent.putExtra("item", new MediaItemDetails(mediaWrapper.getTitle(), mediaWrapper.getArtist(), mediaWrapper.getAlbum(), mediaWrapper.getLocation(), mediaWrapper.getArtworkURL()));
activity.startActivity(intent);
} else if (mediaWrapper.getType() == MediaWrapper.TYPE_DIR){
Intent intent = new Intent(activity, VerticalGridActivity.class);
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
index add13d4..dd94668 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
@@ -28,7 +28,6 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
-import android.os.Parcelable;
import android.support.v17.leanback.widget.OnItemViewClickedListener;
import android.support.v17.leanback.widget.OnItemViewSelectedListener;
import android.support.v17.leanback.widget.Presenter;
@@ -159,7 +158,9 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
DetailsActivity.class);
// pass the item information
intent.putExtra("media", mItemSelected);
- intent.putExtra("item", (Parcelable) new MediaItemDetails(mItemSelected.getTitle(), mItemSelected.getArtist(), mItemSelected.getAlbum(), mItemSelected.getLocation()));
+ intent.putExtra("item", new MediaItemDetails(mItemSelected.getTitle(),
+ mItemSelected.getArtist(), mItemSelected.getAlbum(),
+ mItemSelected.getLocation(), mItemSelected.getArtworkURL()));
startActivity(intent);
}
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
index a4bf2ca..84cd2bb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
@@ -120,7 +120,9 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
DetailsActivity.class);
// pass the item information
intent.putExtra("media", mItemSelected);
- intent.putExtra("item", new MediaItemDetails(mItemSelected.getTitle(), mItemSelected.getArtist(), mItemSelected.getAlbum(), mItemSelected.getLocation()));
+ intent.putExtra("item", new MediaItemDetails(mItemSelected.getTitle(),
+ mItemSelected.getArtist(), mItemSelected.getAlbum(),
+ mItemSelected.getLocation(), mItemSelected.getArtworkURL()));
startActivity(intent);
}
More information about the Android
mailing list