From 7757eb24d95f4023320a9154aad5b367b1b65ca5 Mon Sep 17 00:00:00 2001 From: David Luhmer Date: Thu, 23 Jul 2020 17:14:17 +0200 Subject: [PATCH] detail view: fallback to media description if body is empty Signed-off-by: David Luhmer --- .../owncloudnewsreader/adapter/NewsListRecyclerAdapter.java | 2 -- .../owncloudnewsreader/async_tasks/RssItemToHtmlTask.java | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java index 17499121..15eacc48 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/adapter/NewsListRecyclerAdapter.java @@ -163,8 +163,6 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter { layout = R.layout.subscription_detail_list_item_thumbnail; break; case 1: - layout = R.layout.subscription_detail_list_item_text; - break; case 3: layout = R.layout.subscription_detail_list_item_text; break; diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/RssItemToHtmlTask.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/RssItemToHtmlTask.java index bed2085e..40b74efa 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/RssItemToHtmlTask.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/async_tasks/RssItemToHtmlTask.java @@ -125,6 +125,11 @@ public class RssItemToHtmlTask extends AsyncTask { } String description = rssItem.getBody(); + if(description.isEmpty() && rssItem.getMediaDescription() != null) { + // in case the rss body is empty, fallback to the media description (e.g. youtube / ted talks) + description = rssItem.getMediaDescription(); + } + if(!incognitoMode) { // If incognito mode is disabled, try getting images from cache description = getDescriptionWithCachedImages(description).trim();