summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java17
-rw-r--r--app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java37
3 files changed, 44 insertions, 16 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java
index 06c80e173..62b22879a 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java
@@ -44,7 +44,7 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
holder.image = convertView.findViewById(R.id.imgvCover);
holder.title = convertView.findViewById(R.id.txtvTitle);
holder.subscribers = convertView.findViewById(R.id.txtvSubscribers);
- holder.url = convertView.findViewById(R.id.txtvUrl);
+ holder.author = convertView.findViewById(R.id.txtvAuthor);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
@@ -64,7 +64,7 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
holder.title.setText(podcast.getTitle());
holder.subscribers.setText(String.valueOf(podcast.getSubscribers()));
- holder.url.setText(podcast.getUrl());
+ holder.author.setText(podcast.getAuthor());
return convertView;
}
@@ -73,6 +73,6 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
ImageView image;
TextView title;
TextView subscribers;
- TextView url;
+ TextView author;
}
}
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java
index cc3b6fba0..7917c264f 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java
@@ -65,13 +65,16 @@ public class ItunesAdapter extends ArrayAdapter<PodcastSearchResult> {
viewHolder = (PodcastViewHolder) view.getTag();
}
- //Set the title
+ // Set the title
viewHolder.titleView.setText(podcast.title);
- if(podcast.feedUrl != null && !podcast.feedUrl.contains("itunes.apple.com")) {
- viewHolder.urlView.setText(podcast.feedUrl);
- viewHolder.urlView.setVisibility(View.VISIBLE);
+ if (podcast.author != null && ! podcast.author.trim().isEmpty()) {
+ viewHolder.authorView.setText(podcast.author);
+ viewHolder.authorView.setVisibility(View.VISIBLE);
+ } else if (podcast.feedUrl != null && !podcast.feedUrl.contains("itunes.apple.com")) {
+ viewHolder.authorView.setText(podcast.feedUrl);
+ viewHolder.authorView.setVisibility(View.VISIBLE);
} else {
- viewHolder.urlView.setVisibility(View.GONE);
+ viewHolder.authorView.setVisibility(View.GONE);
}
//Update the empty imageView with the image from the feed
@@ -103,7 +106,7 @@ public class ItunesAdapter extends ArrayAdapter<PodcastSearchResult> {
*/
final TextView titleView;
- final TextView urlView;
+ final TextView authorView;
/**
@@ -113,7 +116,7 @@ public class ItunesAdapter extends ArrayAdapter<PodcastSearchResult> {
PodcastViewHolder(View view){
coverView = view.findViewById(R.id.imgvCover);
titleView = view.findViewById(R.id.txtvTitle);
- urlView = view.findViewById(R.id.txtvUrl);
+ authorView = view.findViewById(R.id.txtvAuthor);
}
}
}
diff --git a/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java b/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java
index 6535df5ef..481c232c8 100644
--- a/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java
+++ b/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java
@@ -25,15 +25,26 @@ public class PodcastSearchResult {
@Nullable
public final String feedUrl;
+ /**
+ * artistName of the podcast feed
+ */
+ @Nullable
+ public final String author;
- private PodcastSearchResult(String title, @Nullable String imageUrl, @Nullable String feedUrl) {
+
+ private PodcastSearchResult(String title, @Nullable String imageUrl, @Nullable String feedUrl, @Nullable String author) {
this.title = title;
this.imageUrl = imageUrl;
this.feedUrl = feedUrl;
+ this.author = author;
+ }
+
+ private PodcastSearchResult(String title, @Nullable String imageUrl, @Nullable String feedUrl) {
+ this(title, imageUrl, feedUrl, "");
}
public static PodcastSearchResult dummy() {
- return new PodcastSearchResult("", "", "");
+ return new PodcastSearchResult("", "", "", "");
}
/**
@@ -46,7 +57,8 @@ public class PodcastSearchResult {
String title = json.optString("collectionName", "");
String imageUrl = json.optString("artworkUrl100", null);
String feedUrl = json.optString("feedUrl", null);
- return new PodcastSearchResult(title, imageUrl, feedUrl);
+ String author = json.optString("artistName", null);
+ return new PodcastSearchResult(title, imageUrl, feedUrl, author);
}
/**
@@ -68,14 +80,27 @@ public class PodcastSearchResult {
}
String feedUrl = "https://itunes.apple.com/lookup?id=" +
json.getJSONObject("id").getJSONObject("attributes").getString("im:id");
- return new PodcastSearchResult(title, imageUrl, feedUrl);
+
+ String author = null;
+ try {
+ author = json.getJSONObject("im:artist").getString("label");
+ } catch (Exception e) {
+ // Some feeds have empty artist
+ }
+ return new PodcastSearchResult(title, imageUrl, feedUrl, author);
}
public static PodcastSearchResult fromFyyd(SearchHit searchHit) {
- return new PodcastSearchResult(searchHit.getTitle(), searchHit.getThumbImageURL(), searchHit.getXmlUrl());
+ return new PodcastSearchResult(searchHit.getTitle(),
+ searchHit.getThumbImageURL(),
+ searchHit.getXmlUrl(),
+ searchHit.getAuthor());
}
public static PodcastSearchResult fromGpodder(GpodnetPodcast searchHit) {
- return new PodcastSearchResult(searchHit.getTitle(), searchHit.getLogoUrl(), searchHit.getUrl());
+ return new PodcastSearchResult(searchHit.getTitle(),
+ searchHit.getLogoUrl(),
+ searchHit.getUrl(),
+ searchHit.getAuthor());
}
}