diff options
author | defkev <[email protected]> | 2023-05-20 14:39:26 +0200 |
---|---|---|
committer | defkev <[email protected]> | 2023-05-20 14:39:26 +0200 |
commit | 9e169dc3aa7c7e30c11d7d3d1bbc4bc66fa39760 (patch) | |
tree | 05207b24da95ed9ee45582e1c63f7344e97c7a29 /org.fox.ttrss/src/main/java/org | |
parent | e6813c7ffc9d3d876319a8322e9636c3b4694f57 (diff) |
Add hostname of link to article fragment
* only if link hostname differs from comment_link hostname
* omit www. prefix if present
Diffstat (limited to 'org.fox.ttrss/src/main/java/org')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index beff9a1f..bf89e324 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -335,6 +335,20 @@ public class ArticleFragment extends StateSavedFragment { } } + TextView host = view.findViewById(R.id.host); + if (host != null) { + try { + URL inurl = new URL(m_article.comments_link); /* This could be improved if /tt-rss/api:getArticle returned feed_url */ + URL outurl = new URL(m_article.link); + String inhost = inurl.getHost(); + String outhost = outurl.getHost(); + if (!inhost.equals(outhost)) { + host.setVisibility(View.VISIBLE); + host.setText(outhost.replaceFirst("^www\\.", "")); + } + } catch (MalformedURLException ignored) {} + } + TextView note = view.findViewById(R.id.note); if (note != null) { |